title: MVC - Passing multiple data tables to a view
body: <p>I currently have the following code in the HomeController of my MVC project:</p>
  
  <pre><code>public class HomeController : Controller
  {
      public ActionResult Index()
      {
          MyDataContext dc = new MyDataContext();
  
          IQueryable&lt;Table1Data&gt; j =
              from n in dc.Table1                     
              select n;
  
          return View(j);
      }
  </code></pre>
  
  <p>So that works okay, but now I want to pass a second table through to the same view.  So I was thinking I should be able to do something like this:</p>
  
  <pre><code>public class HomeController : Controller
  {
      public ActionResult Index()
      {
          MyDataContext dc = new MyDataContext();
  
          IQueryable&lt;Table1Data&gt; j =
              from n in dc.Table1                     
              select n;
  
          IQueryable&lt;Table2Data&gt; l =
              from k in dc.Table2        
              select k;
  
          return View(j, l);
      }
  </code></pre>
  
  <p>Is there a way to have the view accept two models like this or, alternatively, a way to merge the two result sets (the two tables are not linked in any way?</p>