Rohan,
I will give you a small example to make you understand easily. This doesnt make more sense but this beginner terminology might help you to get basic info on what a viewmodel is.
If you create a website like fb..
1. Home page displays Friends Status
2. Home page displays Your profile pic
3. Home page displays advertisements
There are 3 models here
FriendsStatus.cs
ProfileDetails.cs
Advertisements.cs
Considering MVC - view get data from single model.
We have to show all there models info in home page. How?
Create a view model HomeViewModel = FriendsStatus+ProfileDetails+Advertisements (Combination of view model or combination of required properties in models)
Use this HomeViewModel in Facebook Home View.
This is how we pass multiple models to a view.
That is called creating a model required by a view. In layman term, Model required by a view is a view model.
Its not mandatory that you take all properties in models to create a view model. Just create a view model with what ever properties view demand. Let me know if you need a free online training on working on View models.
Chandra Shekar Thota
Founder/Developer
www.hyderabadtechies.info
Laghaterohan, if this helps please login to Mark As Answer. | Alert Moderator