public ActionResult ResultTable() { var options = (MatchSettingsViewModel)Session["MatchOptions"]; var items = (List <DyntaxaMatchItem>)Session["MatchItems"]; if (options.IsNull() || items.IsNull()) { return(RedirectToAction("Settings")); } var manager = new DyntaxaMatchManager(GetCurrentUser()); items = manager.GetMatchResults(items, options); ViewData["MatchItems"] = items; Session["MatchItems"] = items; return(View(options)); }
public ActionResult CreateExcelFile(MatchSettingsViewModel options, List <DyntaxaMatchItem> items, string downloadTokenValue) { if (options.IsNull() || items.IsNull()) { return(RedirectToAction("Settings")); } var manager = new DyntaxaMatchManager(GetCurrentUser()); items = manager.GetMatchResults(items, options); ExcelFileFormat fileFormat = ExcelFileFormat.OpenXml; var fileDownloadName = "match" + ExcelFileFormatHelper.GetExtension(fileFormat); MemoryStream excelFileStream = manager.CreateExcelFile(options, items, fileFormat); var fileStreamResult = new FileStreamResult(excelFileStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); fileStreamResult.FileDownloadName = fileDownloadName; Response.AppendCookie(new HttpCookie("fileDownloadToken", downloadTokenValue)); return(fileStreamResult); }