title: How to show complete table using model in MVC?
body: <p>My database table has 50 rows, how to show all the tables on view using model? When I tried to show the product data on view. It shows the last row of the table, how can I show all rows in the view?</p>
  
  <pre><code>//Model : Product Properties 
  
      public class AllItems
      {
          public string ID { get; set; }
          public string Name { get; set; }
          public string Qty { get; set; }
          public string Price { get; set; }
          public string ImgName { get; set; }
          public string PrdDesc { get; set; }
      }
  
  //Controller : Product data action manager
  
          public ActionResult ViewAllItems()
          {
              string[] Name = new string[10];
              DataTable dtProducts = Data.GetAllItems();
  
              for (int i = 0; i &lt; dtProducts.Rows.Count; i++)
              {
                  AllItems allItems = new AllItems
                  {
                      ID = dtProducts.Rows[i][0].ToString(),
                      Name = dtProducts.Rows[i][1].ToString(),
                      Qty = dtProducts.Rows[i][2].ToString(),
                      Price = dtProducts.Rows[i][3].ToString(),
                      PrdDesc = dtProducts.Rows[i][4].ToString(),
                  };
                  ViewData["AllItems"] = allItems;
              }
              return View();
          }
  
  //View to show the Product data
  
  @{
     AllItems allItems = (AllItems)ViewData["AllItems"];
      for (int i = 0; i &lt; 5; i++)
      {
      &lt;table style="border: 1px solid lightgrey; border-collapse: collapse"&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;h3&gt;@allItems.ID&lt;/h3&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;h3&gt;@allItems.Name&lt;/h3&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;h3&gt;@allItems.Price&lt;/h3&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;h3&gt;@allItems.Qty&lt;/h3&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;h3&gt;@allItems.ImgName&lt;/h3&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;h3&gt;@allItems.PrdDesc&lt;/h3&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;br /&gt;
      &lt;/table&gt;       
      }
  }
  </code></pre>
  
  <p>Is there a way I can make an array of the model class and show the properties?</p>