Exemplo n.º 1
0
 public async Task <ActionResult <HRSubmitPictureOutputDto> > Post([FromBody] HRSubmitPictureInputDto picture)
 {
     if (picture == null)
     {
         return(new StatusCodeResult(StatusCodes.Status400BadRequest));
     }
     try
     {
         picture.Id           = Guid.NewGuid();
         using var taskResult = _birdsSubmissionService.AddPictureDataAsync(picture);
         await taskResult;
         if (taskResult.IsCompletedSuccessfully)
         {
             return(Ok(taskResult.Result));
         }
         else
         {
             return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
         }
     }
     catch
     {
         return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
     }
 }