public override async Task <SaveCommentReply> SaveComment(SaveCommentRequest request, ServerCallContext context) { var comment = _mapper.Map <Comment>(request.Comment); var responseComment = await _commentService.SaveCommentAsync(comment); return(new SaveCommentReply { Comment = _mapper.Map <CommentMessage>(responseComment) }); }
public async Task <Comment> SaveCommentAsync(Comment comment) { var request = new SaveCommentRequest { Comment = _mapper.Map <CommentMessage>(comment) }; var reply = await _client.SaveCommentAsync(request); return(_mapper.Map <Comment>(reply.Comment)); }
public CommentsResponse SaveComment(VmrSaveCommentViewModel model) { var modelSave = new SaveCommentRequest { InstanceId = model.InstanceId, Model = model }; return(_commentService.SaveComment(modelSave)); }
public async Task <IActionResult> SaveComment([FromBody] SaveCommentRequest req) { Logger.LogInformation($"Get product comments with filter: ProductCode={req?.ProductCode}"); int?productId = await Service.GetId(req?.ProductCode).ConfigureAwait(false); if (!productId.HasValue) { return(NotFound($"ProductCode={req?.ProductCode}")); } var comment = new CommentDto { Description = req.Description, PosterName = req.PosterName, ProductId = productId.Value, Rating = req.Rating }; await Service.SaveComment(comment).ConfigureAwait(false); return(Ok()); }