public async Task <IActionResult> UploadUploadedDataPdf(UploadedDataPDFUploadModel pdfUploadModel) { try { var core = _core.GetCore(); var saveFolder = Path.Combine(await core.Result.GetSdkSetting(Settings.fileLocationPdf), Path.Combine("pdfFiles")); Directory.CreateDirectory(saveFolder); string fileName = $"ItemCase_{pdfUploadModel.ItemCaseId}_{DateTime.Now.Ticks}.pdf"; if (pdfUploadModel.File.Length > 0) { using (var stream = new FileStream(Path.Combine(saveFolder, fileName), FileMode.Create)) { await pdfUploadModel.File.CopyToAsync(stream); } } if (core.Result.GetSdkSetting(Settings.swiftEnabled).ToString().ToLower() == "true") { await core.Result.PutFileToStorageSystem(Path.Combine(saveFolder, fileName), fileName); } UploadedData uploadedData = new UploadedData(); uploadedData.FileLocation = saveFolder; uploadedData.FileName = fileName; uploadedData.ItemCaseId = pdfUploadModel.ItemCaseId; await uploadedData.Create(_dbContext); return(new OkResult()); } catch (Exception e) { Trace.TraceError(e.Message); _core.LogException(e.Message); return(new BadRequestResult()); } }
public async Task <IActionResult> UploadUploadedDataPdf(UploadedDataPDFUploadModel pdfUploadModel) { return(await _uploadedDataService.UploadUploadedDataPdf(pdfUploadModel)); }