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); }
public ActionResult Index() { UserListModel model = new UserListModel(); model.SearchUsers(1, string.Empty, string.Empty); return View(model); }
public PartialViewResult SearchUsers(int pageNumber, string firstName, string lastName) { UserListModel model = new UserListModel(); model.SearchUsers(pageNumber,firstName,lastName); return PartialView("_UserList", model.SearchResult); }