public async Task <BaseApiResponse> Edit(EditGoodsBlockWarpRequest request) { request.CheckNotNull(nameof(request)); //判断 var goodsBlockWarp = _goodsBlockWarpQueryService.Find(request.Id); if (goodsBlockWarp == null) { return(new BaseApiResponse { Code = 400, Message = "没找到该项目" }); } var command = new UpdateGoodsBlockWarpCommand( request.Name, request.Style, request.GoodsBlocks, request.IsShow, request.Sort) { AggregateRootId = request.Id }; var result = await ExecuteCommandAsync(command); if (!result.IsSuccess()) { return(new BaseApiResponse { Code = 400, Message = "命令执行失败" }); } return(new BaseApiResponse()); }
public void Handle(ICommandContext context, UpdateGoodsBlockWarpCommand command) { context.Get <GoodsBlockWarp>(command.AggregateRootId).Update( new GoodsBlockWarpInfo( command.Name, command.Style, command.GoodsBlocks, command.IsShow, command.Sort)); }