예제 #1
0
        public async Task <ActionResult> Update(int id, CommentRequest commentRequest)
        {
            var updateCommentCommand = new UpdateCommentCommand
            {
                Id      = id,
                Content = commentRequest.Content
            };
            await Mediator.Send(updateCommentCommand);

            return(NoContent());
        }
예제 #2
0
        public async Task <ActionResult> Create(int postId, CommentRequest commentRequest)
        {
            var addCommentCommand = new AddCommentCommand
            {
                Content = commentRequest.Content,
                PostId  = postId,
                UserId  = User.FindFirst(ClaimTypes.NameIdentifier)?.Value
            };
            var createdCommentId = await Mediator.Send(addCommentCommand);

            return(StatusCode(201, createdCommentId));
        }