title: Retrieve lists from Controller to View using Entity Framework
body: <p>I am trying to retrieve the list of datas in view from controller in ASP.Net .
  I have two models </p>
  
  <pre><code>public class TableGroupModel
  {
      public int groupId { get; set; }
      public string groupName { get; set; }
      public string color { get; set; }
      public bool is_active { get; set; }
      public int groupPosition { get; set; }
  }
  </code></pre>
  
  <p>and another model</p>
  
  <pre><code>  public class TableModel
       {
           public int tableId { get; set; }
           public string  tableName { get; set; }
           public bool isReserved { get; set; }
           public int seats { get; set; }
           public string tableType { get; set; }
           //added from cafe_table_group
  
           List&lt;Models.TableGroupModel&gt; group { get; set; }
       }
  </code></pre>
  
  <p>My controller is </p>
  
  <pre><code>  public ActionResult Index()
           {
               using(entity_framework.dbEntities e=new entity_framework.dbEntities())
               {
  
                   var tables = (from c in e.cafe_table
                                join d in e.cafe_table_group on c.cafe_table_group_id equals d.cafe_table_group_id
                                orderby c.cafe_table_group_id
                                select new
                                {
                                    c.cafe_table_id,
                                   c.table_name,
                                    c.seats,
                                     c.is_reserved,
                                    d.cafe_table_group_name,
                                  d.color
                                }).ToList();
                   return View(tables);
               }
           }
  </code></pre>
  
  <p>Now how can I use data list in view? </p>