public async Task <ICommandResult> Handle(AttrCategoryRemoveCommand mesage)
        {
            try
            {
                AttrCategory attrCategory = new AttrCategory();
                attrCategory.Remove(mesage);
                await _attrCategoryService.RemoveToDb(attrCategory);

                ICommandResult result = new CommandResult()
                {
                    Message  = "",
                    ObjectId = attrCategory.Id,
                    Status   = CommandResult.StatusEnum.Sucess
                };
                return(result);
            }
            catch (Exception e)
            {
                e.Data["Param"] = mesage;
                ICommandResult result = new CommandResult()
                {
                    Message = e.Message,
                    Status  = CommandResult.StatusEnum.Fail
                };
                return(result);
            }
        }
示例#2
0
        public async Task <CommandResult> SendCommand(AttrCategoryRemoveCommand command)
        {
            CommandResult commandResult = await _commandService.SendAndReceiveResult <CommandResult>(command);

            return(commandResult);
        }
示例#3
0
 public void Remove(AttrCategoryRemoveCommand command)
 {
     AttributeId = command.AttributeId;
     CategoryId  = command.CategoryId;
     RemoveEvent();
 }