Exemplo n.º 1
0
 public async Task <UseCaseResult <DownloadFileModel> > Handle(DownloadFile request, CancellationToken cancellationToken)
 {
     try
     {
         if (!string.IsNullOrEmpty(request.FileReference))
         {
             var props = _fileStoreService.GetProperties(request.FileReference);
             var model = new DownloadFileModel
             {
                 ContentType = props.ContentType,
                 Contents    = await _fileStoreService.GetAsync(request.FileReference)
             };
             return(UseCaseResult <DownloadFileModel> .Create(model));
         }
         else
         {
             return(UseCaseResult <DownloadFileModel> .CreateError(resultText : "File Reference not found"));
         }
     }
     catch (Exception e)
     {
         return(UseCaseResult <DownloadFileModel> .CreateError(resultText : e.Message));
     }
 }