title: How to pass two objects of different class to the View's model
body: <p>In <code>Details</code> view of a Person I would like to also display also other objects from the <code>DbContext</code>, every record of table <code>Survey</code> to be exact. So I inserted them into <code>ViewBag</code></p>
  
  <p>Person's controller action:</p>
  
  <pre><code>   [HttpPost]
          public ActionResult _Survey1(int id) {
              System.Diagnostics.Debug.WriteLine("PASSED ID: " + id);
              Person person = db.Persons.Find(id);
              ViewBag.Surveys = db.Surveys.ToList();//HERE I insert Surveys to ViewBag
              return PartialView(person);
          }
  </code></pre>
  
  <p>and try to iterate over them in View :</p>
  
  <pre><code>@model WebApplication2.Models.Person
  &lt;hr /&gt;
  &lt;h2&gt;Survey&lt;/h2&gt;
  
  &lt;input type="button" id="Coll" value="Collapse" onclick="javascript:CollapseDiv()" /&gt;
  &lt;p&gt;
      @Html.DisplayFor(x =&gt; ViewBag.Surveys.Count)
  &lt;/p&gt;
  @foreach (var survey in ViewBag.Surveys) {
      &lt;p&gt;
          @using (Html.BeginForm()) {
  
              &lt;text&gt;ANK&lt;/text&gt;
              @Html.DisplayFor(x =&gt; survey.Questions.Count)
              @Html.EditorFor(x =&gt; survey.Questions) 
              &lt;input type="submit" /&gt;
          }
      &lt;/p&gt;
  }
  
  &lt;hr /&gt;
  </code></pre>
  
  <p>The problem is that I get:</p>
  
  <p><img src="https://i.stack.imgur.com/7Ej35.png" alt="enter image description here"></p>
  
  <p><strong>Question:</strong>  As tschmit007 suggested how to define model which can take <code>Person</code> and `IEnumerable and pass data to it?</p>