title: Nested foreach from 2 different tables
body: <pre><code>    TitleTable         TextTable
  -------------------  ---------------
  Id(int)               Id (int)
  Title(string)         TitleTableId (int)
                        Text (string)
                        TitleOfText(int)
  </code></pre>
  
  <p>So here is what I try to do:
  I have 1 table that holds a title (titletable) and one more table which holds Text(text table), So one title will have several text that's why I use 2 tables.
  And I can list Table 1 here is the code view:</p>
  
  <pre><code>@foreach (var item in Model.TitleTable)
    {
       @item.Title
    }  
  </code></pre>
  
  <p>And not I need another foreach to bring text of the titles I tried this ;</p>
  
  <pre><code>    @foreach (var item in Model.TitleTable)
      {
        @item.Title
  
          foreach (var itemDesc in Model.Text.OrderBy(o =&gt; o.Id).Where(o =&gt; o.Id == item.Id))
           {
               @itemDesc.Text
           }
       }  
  </code></pre>
  
  <p>and this returns null because I dont give any Id to return it only takes it from view model not from the controller so how can I reach the text and it should look like this at the end ;</p>
  
  <pre><code>Title 1
                                     Text 1of title 1
                                     Text 2of title 1
  title 2                         
                                     text 1 of title2
                                     text 2 of title2
     @foreach (var item in Model.TitleTable)
     {
        @item.Title
  
       foreach (var itemDesc in Model.Text.Where(o =&gt; o.TitleTable== item.Id))
        {
         @itemDesc.Text
        }
      }  
  </code></pre>