public async Task <IActionResult> CreateComment([FromBody] ClientCommentCreate newComment) { var comment = _mapper.Map <Comment>(newComment); comment.PostedAt = DateTimeOffset.UtcNow; await _uow.CommentRepository.Insert(comment); _logger.LogInformation($"Comment with id {comment.Id} was created."); var returnComment = _mapper.Map <ClientComment>(comment); var userAuthor = await _uow.UserRepository.GetById(newComment.AuthorId); returnComment.Author = _mapper.Map <ClientUser>(userAuthor); return(Ok(returnComment)); }
public void HandleValidSubmit() { ClientCommentCreated.AuthorId = LoggedInUser.Id; if (Comment != null) { ClientCommentCreated.CommentId = Comment.CommentId == null ? Comment.Id : Comment.CommentId; } else { ClientCommentCreated.PostId = ParentPostId; } Dispatcher.Dispatch(new SendCommentAction(ClientCommentCreated)); ClientCommentCreated = new ClientCommentCreate(); CommentSent.InvokeAsync(true); }
public SendCommentAction(ClientCommentCreate newComment) { NewComment = newComment; }