public virtual IActionResult ExportReportContractAB(ReportContractABSearchModel searchModel) { if (!string.IsNullOrEmpty(searchModel.stringConstructionIds)) { var listConstruction = searchModel.stringConstructionIds.Split(',').ToList(); searchModel.SelectedConstructionIds = listConstruction.Select(c => (int)c.ToNumber()).ToList(); } try { var report = _reportService.GetContractReportAB( constructionType: searchModel.constructionType, contractCodeName: searchModel.contractCodeName, datetimeFrom: searchModel.datetimeFrom, datetimeTo: searchModel.datetimeTo); byte[] bytes; using (var stream = new MemoryStream()) { _exportManager.ExportExcelContractAB(report, stream, Convert.ToDateTime(searchModel.datetimeFrom), Convert.ToDateTime(searchModel.datetimeTo)); bytes = stream.ToArray(); } return(File(bytes, MimeTypes.TextXlsx, "BaoCaoHopDongAB.xlsx")); } catch (Exception exc) { ErrorNotification(exc); return(RedirectToAction("List")); } }