KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've been able to successfully return a model to a view and display the results in a strongly-typed fashion. I have never seen an example where multiple models get returned. How do I go about that? I suppose the controller would have something like this: return View(lemondb.Messages.Where(p => p.user == tmp_username).ToList(), lemondb.Lemons.Where(p => p.acidity >= 2).ToList()); Does MVC let you return multiple models like that? And then in the view I have this line at the top of the file: @model IEnumerable<ElkDogTrader.Models.Message> And I frequently make calls to "model" in the view. @foreach (var item in Model) If there were 2 models, how would I refer to them separately? Is this possible with multiple models, or is this why people use ViewBag and ViewData?
Tags (comma-separated)
Save Edits
Cancel