public async Task <ActionResult> FileUploads(IFormFileCollection files, CancellationToken cancellationToken = default) { if (files.Count == 0) { files = Request.Form.Files; } if (files.Count == 0) { return(BadRequest("No files detected")); } // convert to pdfs using var scope = _serviceProvider.CreateScope(); var pdfProcessor = scope.ServiceProvider.GetRequiredService <IPdfProcessor>(); var filesToUpload = await pdfProcessor.RenderPdfs(files, cancellationToken); var concurrentCollection = new StreamConcurrentCollection(filesToUpload); await _bucketRepository.UploadFiles(_awsSetting.BucketName, concurrentCollection, cancellationToken); //TempData["files"] = JsonConvert.SerializeObject(filesToUpload); _bucketRepository.Dispose(); concurrentCollection.Dispose(); concurrentCollection.Clear(); var result = filesToUpload.Select(f => f.Name).ToList(); return(Ok(result)); //return RedirectToAction("UploadComplete"); }
protected override void Dispose(bool disposing) { if (disposing) { if (_accountCodeRepository != null) { _accountCodeRepository.Dispose(); _accountCodeRepository = null; } if (_customerDynamicsRepository != null) { _customerDynamicsRepository.Dispose(); _customerDynamicsRepository = null; } if (_bucketRepository != null) { _bucketRepository.Dispose(); _bucketRepository = null; } } base.Dispose(disposing); }