title: How to select from two table by id in mvc5
body: <p>I'm new to MVC5,I had troubles with the problem.
  can anybody help me?</p>
  
  <p>I have 2 table, <code>DocMain(Doc_Id,Doc_Title)</code> , <code>DocProduct(Doc_Id,Doc_Content)</code>,
  I want to select the 2 table content by the same <code>Doc_Id</code>. 
  And loop them. 
  Display like:</p>
  
  <pre><code>&lt;ul&gt; 
  &lt;li&gt;&lt;a href="1"&gt;title1&lt;/a&gt;content1&lt;/li&gt; 
  &lt;li&gt;&lt;a href="2"&gt;title2&lt;/a&gt;content2&lt;/li&gt;
  &lt;li&gt;&lt;a href="3"&gt;title3&lt;/a&gt;content3&lt;/li&gt; 
  &lt;/ul&gt;
  </code></pre>
  
  <p>....
  And how to do it?</p>
  
  <pre><code>//Here is my viewmodel
  
  public class MainProductViewModel
  {
      public IEnumerable&lt;DocMainListView&gt; DocMainListView { get; set; }
      public IEnumerable&lt;DocProductListView&gt; DocProductListView { get; set; }
  }
  
  -------------------------------------------------
  
  //Here is my controller
  public class DocProductController : Controller
  {
  private IDocProductRepository repository;
  private IDocMainRepository repositoryMain;
  
  public DocProductController(IDocProductRepository docProductRepository, IDocMainRepository docMainRepository)
  {
      this.repository = docProductRepository;
      this.repositoryMain = docMainRepository;
  }
  
  
  public ActionResult List()
  {
      var products = from docProduct in repository.DocProduct
                     join docMain in repositoryMain.DocMain
                     on docProduct.Doc_Id equals docMain.Doc_Id
                     select new { DocMainTitle = docMain.Doc_Title, DocProductContent = docProduct.DocProduct_Content };
  
      //ViewBag.products = products;
  
  
      //DocProductListView model = new DocProductListView
      //{
      //    DocProduct = repository.DocProduct
      //    .Join(repositoryMain.DocMain,
      //    docProduct =&gt; docProduct.Doc_Id,
      //    docMain =&gt; docMain.Doc_Id,
      //    (docProduct, docMain) =&gt; new { a = docMain.Doc_Id, b = docProduct.Doc_Id })
      //    .OrderByDescending(n =&gt; n.)
      //};    
  
      return View(products);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I don't know how to write the controller code and View code.</p>