title: The model item passed into the dictionary is of type 'System.Tuple MVC
body: <p>I want to pass two model to View.
   I have two models </p>
  
  <pre><code>public class Department
  {
      public int DepartmentID { get; set; }
      public string DepartmentName { get; set; }
      public string Image { get; set; }
  
      public List&lt;Teacher&gt; Teachers { get; set; }
  }
  </code></pre>
  
  <p>and second </p>
  
  <pre><code> public class Teacher
  {
      public int TeacherID { get; set; }
      public string TeacherName { get; set; }
      public string TeacherLname { get; set; }
      public int DepartmentID { get; set; }
      public string Image { get; set; }
  
      public Department Department { get; set; }
  
  
  }
  </code></pre>
  
  <p>I made a ViewModel</p>
  
  <pre><code>public class ViewModel
  {
      public List&lt;Teacher&gt; Teachers { get; set; }
      public List&lt;Department&gt; Departments { get; set; } 
  }
  </code></pre>
  
  <p>My Controller  </p>
  
  <pre><code> public ActionResult Index()
      {
          ViewModel model = new ViewModel();
  
          // retreive from database
          model.Teachers = new List&lt;Teacher&gt;() { new Teacher() };
          model.Departments = new List&lt;Department&gt;() { new Department() };
  
          return View(model);
      }
  </code></pre>
  
  <p>and a  in the view I have following</p>
  
  <pre><code>@model Tuple&lt;IEnumerable&lt;_167School.Models.Teacher&gt;,IEnumerable&lt;_167School.Models.Department&gt;&gt;
  
  
  @foreach (var student in Model.Item2)
  {
      &lt;tr&gt;
          &lt;td&gt;@student.DepartmentName&lt;/td&gt;
  
      &lt;/tr&gt;
  }
  @foreach (var teacher in Model.Item1)
  {
      &lt;tr&gt;
          &lt;td&gt;@teacher.TeacherName&lt;/td&gt;
          &lt;td&gt;@teacher.TeacherLname&lt;/td&gt;
          &lt;td&gt;@teacher.DepartmentID&lt;/td&gt;
      &lt;/tr&gt;
  }
  </code></pre>
  
  <p>and site goes on runtime and tell me that </p>
  
  <pre><code>The model item passed into the dictionary is of type '_167School.ViewModels.ViewModel', but this dictionary requires a model item of type 'System.Tuple`2[System.Collections.Generic.IEnumerable`1[_167School.Models.Teacher],System.Collections.Generic.IEnumerable`1[_167School.Models.Department]]'.
  </code></pre>
  
  <p>I want to display two models data in one View. I tried this way.</p>
  
  <p>PLEASE HELP
  Thanks </p>