public async Task <Document> UploadDocument(int customerId, DocumentCreate createRequest, CancellationToken cancellationToken) { bool existsCustomer = await uow.Set <Customer>().AnyAsync(x => x.Id == customerId, cancellationToken); if (!existsCustomer) { throw new ObjectNotFoundException("Customer nebyl nalezen!"); } string containerName = ContainerPaths.CustomerDocuments(customerId); DocumentDbo document = mapper.Map <DocumentDbo>(createRequest, x => x.Items.Add("customerId", customerId)); await azureStorageService.UploadAsync(createRequest.Datastream, containerName, document.Id.ToString(), cancellationToken); uow.Add(document); await uow.SaveChangesAsync(cancellationToken); return(mapper.Map <Document>(document)); }
public string Resolve(DocumentDbo source, Document destination, string member, ResolutionContext context) { return(azureStorageService.GetBlobUrl(ContainerPaths.CustomerDocuments(source.CustomerId), source.Id.ToString())); }