public async Task <ModelMenuHome2_DownloadFile> DownloadFileHome2Async(string project_number) { var file_download = await _IDocMenuHomeRepository.GetFileDownloadHome2Async(project_number); if (file_download != null) { string extention = ""; if (!string.IsNullOrEmpty(file_download.filename1) && !string.IsNullOrEmpty(file_download.filename2)) { extention = ".zip"; } if (!string.IsNullOrEmpty(file_download.filename1) && string.IsNullOrEmpty(file_download.filename2)) { extention = ".pdf"; } if (!string.IsNullOrEmpty(file_download.filename2) && string.IsNullOrEmpty(file_download.filename1)) { extention = ".pdf"; } string fileZipName = project_number + "-" + DateTime.Now.ToString("ddMMyyHHtt") + extention; ModelMenuHome2_DownloadFile download_file = new ModelMenuHome2_DownloadFile(); download_file.filename = fileZipName; download_file.filebase64 = ServerDirectorys.DownloadFileHome2(_IEnvironmentConfig.PathArchive, _IEnvironmentConfig.PathDocument, FolderDocument.menuA2, project_number, fileZipName, file_download.filename1, file_download.filename2); if (download_file.filebase64 != null) { return(download_file); } } return(null); }
public async Task <IActionResult> DownloadFileHome2(string ProjectNumber) { ModelMenuHome2_DownloadFile e = await _IDocMenuHomeService.DownloadFileHome2Async(ProjectNumber); if (e != null) { return(Ok(e)); } else { return(BadRequest()); } }