示例#1
0
        public async Task <IActionResult> PostComment(TodoCommentDto todoCommentDto)
        {
            if (todoCommentDto == null)
            {
                return(BadRequest("Invalid comment parameters"));
            }

            return(Ok(await _todoCommentsService.PostComment(todoCommentDto)));
        }
示例#2
0
        public async Task <TodoComment> PostComment(TodoCommentDto todoCommentDto)
        {
            var comment = new TodoComment
            {
                AuthorName   = _currentUser.Username,
                AuthorId     = _currentUser.Id,
                CommentBody  = todoCommentDto.CommentBody,
                ParentTodoId = todoCommentDto.ParentTodoId,
            };

            await _dbRepository.AddAsync(comment);

            return(comment);
        }