Hello hello. Here's what I have. I have an MVC application where all the data is tied together by VisitDate table in my database. The home page is a strongly typed view of type VisitDate, all it does is pull up some simple data. Now, here's where I'm having a problemo. I need a link that passes the current model in the view back to a seperate controller action so I can render a different page with different data.
Here are my two controller actions. I'm going from News.aspx to FrontPage.aspx and hopefully passing SchoolVisit.
Function News(ByVal SchoolVisit As SchoolVisitDate) As ActionResult
Dim db As New NewsData.NewsDB
Dim repos As New NewsRepository
Dim _classId As Integer
_classId = (From a In db.SchoolClasses Where a.VisitDateID = SchoolVisit.VisitDateID Select a.ClassID).Single()
ViewData("VisitDate") = FormatDateTime(SchoolVisit.VisitDate, vbShortDate)
ViewData("Staff") = repos.GetStaff(_classId)
ViewData("StockArticles") = From a In db.StockArticles Select a
ViewData("Articles") = repos.GetArticles(_classId)
Return View()
End Function
Function FrontPage(ByVal SchoolVisit As SchoolVisitDate) As ActionResult
Dim repos As New NewsRepository
Dim _VisitDateID As Integer
_VisitDateID = SchoolVisit.VisitDateID
ViewData("Editorial") = repos.GetEditorial(_VisitDateID)
Return View()
End Function