Ejemplo n.º 1
0
 public async Task <ActionResult> PartiallyUpdateComment(string commentId, JsonPatchDocument <PostCommentToUpdateDto> patchDocument)
 {
     try
     {
         if (Guid.TryParse(commentId, out Guid gCommentId))
         {
             if (await _postCommentService.TryUpdatePostCommentAsync(gCommentId, patchDocument))
             {
                 return(NoContent());
             }
             else
             {
                 return(BadRequest());
             }
         }
         else
         {
             return(BadRequest($"{commentId} is not valid guid."));
         }
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, "Error occured during updating the comment. Comment id: {commentId}", commentId);
         return(StatusCode(StatusCodes.Status500InternalServerError));
     }
 }