title: How do i get data from records in C# MVC
body: <p>I have this code to get the list of record from database, in the list of iDConfig there are some columns i wants to get and put it in model to display as table in the view how do i loop through the list and get the wanted columns?</p>
  
  <pre><code>public ActionResult iDeal_Table_Display(Guid? SA=null)
  {
      var iDConfig = blergo.Get_iDealConfigs(SA, out retStatus, out errorMsg);
      ViewBag.iDconfigs = iDConfig;
      return PartialView();
  }
  </code></pre>
  
  <p>this are the column in each row
  <a href="https://i.stack.imgur.com/8h3Zp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8h3Zp.png" alt="enter image description here"></a>
  the following image is the database columns that i want in iDConfig
  <a href="https://i.stack.imgur.com/nqSNN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nqSNN.png" alt=""></a></p>
  
  <p>using model below</p>
  
  <pre><code>public class iDealModel
  {
      [Required]
      [DisplayName("Product")]
      public Guid ProductId { get; set; }
  
      [Required]
      [DisplayName("Request Type")]
      public Guid RequestTypeId { get; set; }
  
      [Required]
      [DisplayName("Sales Agreement Prefix")]
      public Guid SaPrefix { get; set; }
  
      [DisplayName("Calendar Code")]
      public System.Nullable&lt;System.Guid&gt; CalendarCode { get; set; }
  
      [DisplayName("Cash &amp; Carry")]
      public bool CashnCarry { get; set; }
  
      [DisplayName("Free MM")]
      public bool FreeMM { get; set; }
  
      [DisplayName("On Contract")]
      public bool OnContract { get; set; }
  }
  </code></pre>