コード例 #1
0
        public async Task <ICommandResult> Handle(ProductGroupCategoryChangeCommand message)
        {
            try
            {
                ICommandResult result;
                RProductGroup  rproductGroup = await _productGroupService.Get(message.ProductGroupId);

                if (rproductGroup == null)
                {
                    result = new CommandResult()
                    {
                        Message      = "ProductGroup not found",
                        ObjectId     = "",
                        Status       = CommandResult.StatusEnum.Fail,
                        ResourceName = ResourceKey.ProductGroup_NotFound
                    };
                    return(result);
                }
                ProductGroup productGroup = new ProductGroup(rproductGroup);
                productGroup.ChangeCategory(message.CategoryIds, message.UpdatedUid, message.CreatedDateUtc);
                await _productGroupService.ChangeConditions(productGroup.Id, productGroup.Conditions, productGroup.UpdatedUid, productGroup.UpdatedDateUtc);

                result = new CommandResult()
                {
                    Message  = "",
                    ObjectId = productGroup.Id,
                    Status   = CommandResult.StatusEnum.Sucess
                };
                return(result);
            }
            catch (Exception e)
            {
                e.Data["Param"] = message;
                ICommandResult result = new CommandResult()
                {
                    Message = e.Message,
                    Status  = CommandResult.StatusEnum.Fail
                };
                return(result);
            }
        }
コード例 #2
0
 public async Task <CommandResult> SendCommand(ProductGroupCategoryChangeCommand command)
 {
     return(await _commandService.SendAndReceiveResult <CommandResult>(command));
 }