I'm currently developping a website on asp.net MVC 4. I'm a bit confused about the different ways to pass data from the controller to the view.
First of all, if we have a list of objects users, what's the difference between passing this list to the view using:
return View(users);
and
ViewBag.users = users;
My other question is about the first solution. If we use this solution, do we have to use this
@model IEnumerable<mydb.users>
in the View?
Or could we use for instance
@model IEnumerable<mydb.registrations>
I know it would be odd to use a different model in the view than what we've used in the controller, but VS doesn't seem to be bothered.
Thanls a lot for you answers