public async Task <IActionResult> DownloadOpenApplications(int page = 1) { var applications = await _applyApiClient.GetOpenFinancialApplicationsForDownload(); var exportModel = Mapper.Map <List <RoatpFinancialSummaryExportViewModel> >(applications); var bytearray = _csvExportService .WriteCsvToByteArray <RoatpFinancialSummaryExportViewModel, RoatpFinancialSummaryExportCsvMap>(exportModel); var fileName = $"current_applications_{DateTime.UtcNow:ddMMyy}.csv"; return(File(bytearray, "text/csv", fileName)); }
public async Task <IActionResult> ApplicationDownloadCsv(ApplicationDownloadViewModel viewModel) { if (!ModelState.IsValid) { return(View("~/Views/Roatp/ApplicationDownload.cshtml")); } var applications = await _applyApiClient.GetApplicationOversightDetailsForDownload(viewModel.FromDate.Value, viewModel.ToDate.Value); var exportModel = Mapper.Map <List <RoatpOversightOutcomeExportViewModel> >(applications); var bytearray = _csvExportService .WriteCsvToByteArray <RoatpOversightOutcomeExportViewModel, RoatpOversightOutcomeExportCsvMap>(exportModel); var fileName = $"outcomes_{viewModel.FromDate:ddMMyy}_to_{viewModel.ToDate.Value:ddMMyy}.csv"; return(File(bytearray, "text/csv", fileName)); }