This project is read-only.

MVC Music Store and mvc working pattern

Jan 13, 2011 at 1:08 PM

Hi erveryone, I'm new to ASP.NET and I was trying to understand the principles of the new MVC 2 inclued in visual studio.

Let me explain my view of the MVC aplications first, and then I write my doubt.

Traditionaly the MVC pattern is desinged to keep the aplication separated in different layers and the order of the layers was View-Controller-Model-Dao, I mean the user access to a View through the controller, makes an action (for example "Create an album" ) then the data of the album goes to the controller, it creates a new Album object (with the parameters like "title, genre ...) and then the object goes to the DAO layer which insert it in the database.

But I noticed that this way of working is not used in this MVC Music Store, for example in StoreManagerController class It receives the HttpPost data and calls to storeDB.AddToAlbums(album); and then storeDB.SaveChanges(); directly in this class.

As I said before I'm new with this so maybe I'm wrong, but I know the basics of MVC pattern and I think this is not being followed in this example or at least not being followed strictly.

So, can someone explain or write his point of view with this?

Is this example the correct way of working with MVC pattern? Maybe making these two instructions in a new class, for example AlbumDAO.cs in a method like addAlbum(Album album) makes it more """ traditional MVC pattern """" ??

Thanks in advance