コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public SendCommentAction(ClientCommentCreate newComment)
 {
     NewComment = newComment;
 }