public async Task <IActionResult> UpdateComment(int id, JsonPatchDocument <UpdateCommentDto> commentDto) { var comment = await _repo.GetCommentById(id); if (comment == null) { return(NotFound()); } if (int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value) != comment.UserId) { return(StatusCode(403)); } var commentToPatch = _mapper.Map <UpdateCommentDto>(comment); commentDto.ApplyTo(commentToPatch); _mapper.Map(commentToPatch, comment); _repo.Edit(comment); await _repo.SaveAll(); return(NoContent()); }