Example #1
0
        public ActionResult ExportExcelEarnedLeaveCreditDetails()
        {
            IList <LeaveCreditModel> lstProfile = GetEmployeeELData();
            List <LeaveCreditModel>  excelData  = new List <LeaveCreditModel>();

            excelData = lstProfile.ToList();
            if (excelData.Count > 0)
            {
                string[] columns     = { "Emp Id", "Name", "Joining Date", "Confirmation Date", "Existing EL Balance", "EL Credit", "Total EL Balance" };
                byte[]   filecontent = ExcelExportHelper.ExportExcelELCredit(excelData, "", false, columns);
                return(File(filecontent, ExcelExportHelper.ExcelContentType, "ELCreditReport_" + System.DateTime.Now + ".xlsx"));
            }
            else
            {
                ViewBag.ErrorMsg = "Excel file is not generated as no data returned.";
                return(View("EarnedLeaveCredit"));
            }
        }