예제 #1
0
        public async Task <IActionResult> CreateCommentReplyAsync(Guid membershipUserId, string slug, Guid discussionId, Guid commentId, Comment comment, CancellationToken cancellationToken)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            comment.Content = _htmlSanitizer.Sanitize(comment.Content);

            var childCommentId = await _commentService.CreateCommentReplyAsync(membershipUserId, slug, discussionId, commentId, comment, cancellationToken);

            return(Ok(childCommentId));
        }
예제 #2
0
        public async Task <IActionResult> UpdateCommentAsync(Guid membershipUserId, string slug, Guid discussionId, Guid commentId, Comment comment, CancellationToken cancellationToken)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            comment.Content = _htmlSanitizer.Sanitize(comment.Content);
            var rowVersion = _etagService.GetIfMatch();
            await _commentService.UpdateCommentAsync(membershipUserId, slug, discussionId, commentId, comment, rowVersion, cancellationToken);

            return(Ok());
        }