title: Is there a better solution then ViewData
body: <p>I have a view that runs on a model <code>RETLogModel</code> which pulls from an entirely different connection string then a table called <code>RecordsTaskViews</code>. I need to pass information from <code>RecordsTaskViews</code> based on information gathered by my model.  Currently my function looks like this: </p>
  
  <pre><code>Function RETLog(model As RETModels.RETLogModel) As ActionResult
      Dim id As Integer = model.ActivityIDReturn
      Dim id2 As Integer
      Dim PS As RecordsTaskView = GlobalVar.db.PS.RecordsTaskViews.Find(id)
      If model.ActivityIDReturn &gt; 0 Then
          id2 = model.ActivityIDReturn
      Else : id2 = PS.RefActionID
      End If
      If model.ActivityIDError &gt; 0 Then
          ViewData("ActivityIDErrorValue") = model.ActivityIDError
      Else : ViewData("ActivityIDErrorValue") = PS.RefActionID
      End If
      Dim PS2 As RecordsTaskView = GlobalVar.db.PS.RecordsTaskViews.Find(id2)
      If model.ActivityIDReturn &gt; 0 Then
          If PS IsNot Nothing Then
              ViewData("QRefActionID") = PS.RefActionID
              ViewData("QQutDesc") = PS.QutDesc
              ViewData("QTaskDesc") = PS.TaskDesc
              ViewData("QClientCode") = PS.CltCode
              ViewData("QClientName") = PS.CltDesc
              ViewData("QMemberID") = PS.BenIDin
              ViewData("QMemberName") = PS.BenNameLast &amp; ", " &amp; PS BenNameFirst
              ViewData("QDateStart") = CDate(PS.DateStart).ToString("MM/dd/yyyy")
              ViewData("QDateRes") = CDate(PS.DateResolution).ToString("MM/dd/yyyy")
              ViewData("QCreateUser") = PS.UserIDCreation
              ViewData("QLastChangeUser") = PS.UserIDLastChanged
              ViewData("QDateReport") = CDate(PS.DateReport).ToString("MM/dd/yyyy")
          Else
              ViewData("QQutDesc") = ""
              ViewData("QTaskDesc") = ""
              ViewData("QClientCode") = ""
              ViewData("QClientName") = ""
              ViewData("QMemberID") = ""
              ViewData("QMemberName") = ""
              ViewData("QDateStart") = ""
              ViewData("QDateRes") = ""
              ViewData("QCreateUser") = ""
              ViewData("QLastChangeUser") = ""
              ViewData("QDateReport") = ""
          End If
          If PS2 IsNot Nothing Then
              ViewData("ORefActionID") = PS2.RefActionID
              ViewData("OQutDesc") = PS2.QutDesc
              ViewData("OTaskDesc") = PS2.TaskDesc
              ViewData("OClientCode") = PS2.CltCode
              ViewData("OClientName") = PS2.CltDesc
              ViewData("OMemberID") = PS2.BenIDin
              ViewData("OMemberName") = PS2.BenNameLast &amp; ", " &amp; PS.BenNameFirst
              ViewData("ODateStart") = CDate(PS2.DateStart).ToString("MM/dd/yyyy")
              ViewData("ODateRes") = CDate(PS2.DateResolution).ToString("MM/dd/yyyy")
              ViewData("OCreateUser") = PS2.UserIDCreation
              ViewData("OLastChangeUser") = PS2.UserIDLastChanged
              ViewData("ODateReport") = CDate(PS2.DateReport).ToString("MM/dd/yyyy")
          Else
              ViewData("ORefActionID") = ""
              ViewData("OQutDesc") = ""
              ViewData("OTaskDesc") = ""
              ViewData("OClientCode") = ""
              ViewData("OClientName") = ""
              ViewData("OMemberID") = ""
              ViewData("OMemberName") = ""
              ViewData("ODateStart") = ""
              ViewData("ODateRes") = ""
              ViewData("OCreateUser") = ""
              ViewData("OLastChangeUser") = ""
              ViewData("ODateReport") = ""
          End If
      End If
      If ModelState.IsValid Then
      End If
      Return View(model)
  End Function
  </code></pre>
  
  <p>My issue is this is obviously a boat load of <code>ViewData</code> elements.  Being as I already have <code>@ModelType RETModels.RETLogModel</code> specified in the view itself is there a more efficient way to pass the data to the view? </p>