How do I go about passing two sets of Data to a view in ASP.NET MVC?
I've tried a couple of things and neither have worked so I've come to the simple conclusion: I'm doing it wrong.
I have 2 queries:
callRepository.FindOpenCalls()
and callRepository.FindAllMyCalls(user)
and I want to out put both sets of data to one view via 2 partial views (OpenCalls.ascx and AssignedCalls.ascx respectively).
I'd like to do this using the Index() function in my CallsController.vb.
At the moment I have:
'
' GET: /Calls/
<Authorize()> _
Function Index() As ActionResult
ViewData("OpenCallCount") = callRepository.CountOpenCalls.Count()
ViewData("UrgentCallCount") = callRepository.CountUrgentCalls.Count()
ViewData("HighCallCount") = callRepository.CountHighCalls.Count()
ViewData("NormalCallCount") = callRepository.CountNormalCalls.Count()
ViewData("LowCallCount") = callRepository.CountLowCalls.Count()
ViewData("MyOpenCallsCount") = callRepository.CountMyOpenCalls(Session("LoggedInUser")).Count()
ViewData("UserName") = Session("LoggedInUser")
Dim viewOpenCalls = callRepository.FindAllOpenCalls()
Dim viewMyOpenCalls = callRepository.FindAllMyCalls(Session("LoggedInUser"))
Return View(viewOpenCalls)
End Function
Which returns just the open calls obviously, but I'd like to return both viewOpenCalls and viewMyOpenCalls.
How would I go about it?
Would showing my LINQ help?
Thanks for any help in advance.