public async Task <IActionResult> PostComment(TodoCommentDto todoCommentDto) { if (todoCommentDto == null) { return(BadRequest("Invalid comment parameters")); } return(Ok(await _todoCommentsService.PostComment(todoCommentDto))); }
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); }