title: ASP.NET MVC 4 Joining two tables
body: <p>please may you take a look at my code and point me in the right direction.
  I have 2 tables : Product and vProductAndDescription. I need the Name and LisPrice from Product and the Description from vProductAndDescription joined by their ProductID respectively. Am I on the right track at achieving this in my view? Because so far it is just crashing.</p>
  
  <p>Controller:</p>
  
  <pre><code>public ActionResult Index()
          {
              string query = "SELECT v.Name, p.ListPrice, LEFT(v.Description, 20) from SalesLT.vProductAndDescription v, SalesLT.Product p WHERE v.ProductID = p.ProductID";
              var list = db.Database.SqlQuery&lt;Product&gt;(query);              
              var result = from a in list.ToList()
                      join b in db.vProductAndDescriptions on a.ProductID equals b.ProductID
                      select new
                      {
                          c = a.Name,
                          d = a.ListPrice,
                          e = b.Description
                      };
              return View(result.ToList());
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>@{
      ViewBag.Title = "Index";
  }
  
  &lt;h2&gt;Index&lt;/h2&gt;
  
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;Name
          &lt;/th&gt;
          &lt;th&gt;Price (R)
          &lt;/th&gt;
          &lt;th&gt;Description
          &lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
  @foreach (var item in ViewData.Model) {
      &lt;tr&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Name)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.ListPrice)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Description)
          &lt;/td&gt;
      &lt;/tr&gt;
  }
  &lt;/table&gt;
  </code></pre>