Esempio n. 1
0
        public async Task <IActionResult> UpdateAsync(string postId, [FromBody] CommentDto updatedComment)
        {
            if (!updatedComment.UserId.IsAuthor(User))
            {
                return(Unauthorized());
            }
            try
            {
                await _postCommentService.UpdateAsync(postId, updatedComment);

                return(Ok());
            }
            catch (Exception e)
            {
                _logger.LogError($"Returning exception: {e.Message}");
                return(Json(new ExceptionDto
                {
                    Error = e.Message
                }));
            }
        }