示例#1
0
        private void ProcessCommand(CreateProductDraftCommand productDraftCommand)
        {
            var @event = new CreateProductEvent()
            {
                ProductDraft = productDraftCommand.ProductDraft
            };

            this.Persist(@event, e => {
                Sender?.Tell(e);
                logger.Info("发布事件:{0}", Newtonsoft.Json.JsonConvert.SerializeObject(@event));
                Context.System.EventStream.Publish(e);
            });
        }
示例#2
0
        public async Task <ActionResult> PostDraft([FromBody] CreateProductDraftCommand request)
        {
            var result = await mediator.Send(request);

            return(new JsonResult(result));
        }
        public async Task <CreateProductDraftResult> CreateProductDraftAsync(CreateProductDraftCommand command)
        {
            var productDraft = await _mediator.Send(command);

            return(productDraft);
        }
示例#4
0
 public async Task <ActionResult> PostDraft([FromBody] CreateProductDraftCommand command)
 {
     return(new JsonResult(await _productApplicationService.CreateProductDraftAsync(command)));
 }