예제 #1
0
 public async Task <UseCaseResult <StoredFileModel> > Handle(UploadFile request, CancellationToken cancellationToken)
 {
     try
     {
         if (!string.IsNullOrEmpty(request.FileName))
         {
             if (request.Contents.Length > 0)
             {
                 return(UseCaseResult <StoredFileModel> .Create(_mapper.Map <IFileProperties, StoredFileModel>(await _fileStoreService.PostAsync(request.FileName, request.Contents, request.ContentType))));
             }
             else
             {
                 return(UseCaseResult <StoredFileModel> .CreateError(resultText : "File Contents are empty"));
             }
         }
         else
         {
             return(UseCaseResult <StoredFileModel> .CreateError(resultText : "No File Name Specified"));
         }
     }
     catch (Exception e)
     {
         return(UseCaseResult <StoredFileModel> .CreateError(resultText : e.Message));
     }
 }