public void SearchCertificateExport(CertificateListModel model, int? selectedPage) { model.SearchCertificateList(1, true); MemoryStream report = ExcelManagement.GenerateCertificateReport(model, Server.MapPath("~/Images/Logo-Voc-Iraq.png")); report.Position = 0; string currentDateTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); MicrosoftExcelStreamResult result = new MicrosoftExcelStreamResult(report, "CertificateReport" + currentDateTime + ".xlsx"); Session.Add("CertificateReport", result); }
public void ExportToExcel(string firstName, string lastName) { UserListModel model = new UserListModel(); model.SearchUsers(1, firstName, lastName, true); MemoryStream report = ExcelManagement.GenerateUserReport(model.SearchResult.Collection, Server.MapPath("~/Images/Logo-Voc-Iraq.png")); report.Position = 0; string currentDateTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); MicrosoftExcelStreamResult result = new MicrosoftExcelStreamResult(report, "UserReport" + currentDateTime + ".xlsx"); Session.Add("UserReport", result); }