public ICollection <OrderedBitmapResource> Handle(GetBitmapsForDocumentToProcess query) { if (query.DocumentId == Guid.Empty) { throw new ArgumentNullException(nameof(query.DocumentId)); } using (_context) { var bitmapDefinitions = _context.DocumentBitmaps .Where(doc => doc.DocumentToProcessId == query.DocumentId) .ToList(); var bitmaps = new List <OrderedBitmapResource>(); foreach (var bitmapDefinition in bitmapDefinitions) { var bitmapBytes = File.ReadAllBytes(bitmapDefinition.BitmapPath); bitmaps.Add(new OrderedBitmapResource { FileData = bitmapBytes, Filetype = Path.GetFileName(bitmapDefinition.BitmapPath).AsBitmapFiletype(), Order = bitmapDefinition.Order }); } return(bitmaps); } }
public FileStorageRequestResult <ICollection <OrderedBitmapResource> > Handle(GetBitmapsForDocumentToProcess command) { var url = _persistenceConfiguration.FileStorageApiUserDocumentsUrl + $"/document-to-process/{command.DocumentId}"; return(url.GetJsonAsync <FileStorageRequestResult <ICollection <OrderedBitmapResource> > >().Result); }