public ActionResult ReplyToComment(ReplyToProductCommentCommand command) { if (!ModelState.IsValid) { return(PartialView("ReplyToComment")); } command.UserId = CurrentUser.Id; var result = _commandBus.Send(command); return(JsonMessage(result)); }
public ICommandResult Execute(ReplyToProductCommentCommand command) { try { if (command == null) { throw new ArgumentNullException(); } var comment = _productCommentRepository.GetById(command.CommentId); comment.ParentId = command.ProductId; //ToDo comment.Body = command.Body; _productCommentRepository.Edit(comment); _unitOfWork.Commit(); return(new SuccessResult(ProductCommandMessage.ProductCommentCreatedSuccessufully)); } catch (Exception exception) { _logger.Error(exception.Message); return(new FailureResult(ProductCommandMessage.ProductCommentCreationFailed)); } }