title: How to Join two table and display the data to table in Asp.net MVC
body: <p>i creating a simple car retail system in asp.netmvc.i want to join two table and display the data to table in Asp.net MVC. i don't know how to join and display the data into the table.what i tried so far i attached below.</p>
  
  <p><strong>car model</strong></p>
  
  <pre><code> public partial class carreg
      {
          public int id { get; set; }
          public string carno { get; set; }
          public string make { get; set; }
          public string model { get; set; }
          public string Available { get; set; }
      }
  </code></pre>
  
  <p><strong>rentail model</strong></p>
  
  <pre><code>public partial class rentail
      {
          public int id { get; set; }
          public string carno { get; set; }
          public Nullable&lt;int&gt; custid { get; set; }
          public Nullable&lt;int&gt; fee { get; set; }
          public Nullable&lt;System.DateTime&gt; sdate { get; set; }
          public Nullable&lt;System.DateTime&gt; edate { get; set; }
  
          public virtual rentail rentail1 { get; set; }
  
  }
  </code></pre>
  
  <p>car</p>
  
  <pre><code>id  carno   make    model   Available
  1   A0001   honda   viff    yes
  2   A0002   Honda   uii     no 
  </code></pre>
  
  <p><strong>rentail</strong></p>
  
  <pre><code>  id  carno   custid     fee      sdate       edate
     3    A0001    1      3434      2019-12-09  2019-12-27
     4    A0002    1      12000     2019-11-01  2019-11-29
  </code></pre>
  
  <p>i want to view the data look like this below</p>
  
  <pre><code>   id    carno  custid   fee      sdate       edate       Available  
     3   A0001     1      3434      2019-12-09  2019-12-27    yes
     4   A0002     1      12000     2019-11-01  2019-11-29    no
  </code></pre>
  
  <p><strong>RentController</strong></p>
  
  <pre><code>public ActionResult Index()
          {
              return View(db.rentails.ToList());
          }
  </code></pre>
  
  <p>pass in to view </p>
  
  <pre><code>@model IEnumerable&lt;WebApplication36.Models.rentail&gt;
  
    &lt;table class="table"&gt;
              &lt;tr&gt;
                  &lt;th&gt;
                      Carno
                  &lt;/th&gt;
                  &lt;th&gt;
                      Custid
                  &lt;/th&gt;
                  &lt;th&gt;
                      Fee
                  &lt;/th&gt;
                  &lt;th&gt;
                      Start date
                  &lt;/th&gt;
                  &lt;th&gt;
                      End date
                  &lt;/th&gt;
              &lt;/tr&gt;
  
              @foreach (var item in Model)
              {
                  &lt;tr&gt;
                      &lt;td&gt;
                          @item.carno
                      &lt;/td&gt;
                      &lt;td&gt;
                          @item.custid
                      &lt;/td&gt;
                      &lt;td&gt;
                          @item.fee
                      &lt;/td&gt;
                      &lt;td&gt;
                          @item.sdate
                      &lt;/td&gt;
                      &lt;td&gt;
                         @item.edate
                      &lt;/td&gt; 
                  &lt;/tr&gt;
              }
  
          &lt;/table&gt;
  </code></pre>
  
  <p>In this table i want add another colum available how to join can table and retail to get the data </p>