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); }); }
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); }
public async Task <ActionResult> PostDraft([FromBody] CreateProductDraftCommand command) { return(new JsonResult(await _productApplicationService.CreateProductDraftAsync(command))); }