I have been researching asp.net MVC project structure\'s for a new project and have a question about something is confusing me. What is the difference between models and vie
I've a blog where I want to display the list of the latest posts, latest comments, post categories in a single view. How I can do that? I can strongly type my view to any one of the model right? There comes view model.
I created a view model called BlogViewModel
that contains latest posts, latest comments and other stuff as properties and I bind my view with this model. The posts
, comments
.. are domain models while the BlogViewModel
is the view model I created specially for the view.
Tomorrow I'll show my blog in a mobile version and at that time I may create a simple view model that contains only less properties. Finally.. view models are for views and most of the times they acts as wrappers over the real domain models!