title: How to export data to excel in C# using Linq
body: <p>I have the following controller method that will return the data in model. How do I export all the data to excel?</p>
  
  <pre><code>public ActionResult iDeal_Table_Display(Guid? SA = null)
  {
      var iDConfig = webservice.Get_iDealConfigs(SA,null,null,null,null,null,null, out retStatus, out errorMsg);
  
      var model = iDConfig.Select(ic =&gt; new iDealModel2
      {
          SaPrefix = ic.PrefixName,
          CalendarCode = ic.CalendarCodeName,
          CashnCarry = ic.isCashnCarry,
          FreeMM = ic.isFreeMM,
          OnContract = ic.isOnContract,
          ProductId = ic.ProductName,
          RequestTypeId = ic.RequestTypeName
      }).ToList();
  
      return PartialView(model);
  }
  </code></pre>