Пример #1
0
 public void Change(LocaleStringResourceChangeCommand message)
 {
     Id            = message.Id;
     LanguageId    = message.LanguageId;
     ResourceName  = message.ResourceName;
     ResourceValue = message.ResourceValue;
 }
        public async Task <ICommandResult> Handle(LocaleStringResourceChangeCommand mesage)
        {
            try
            {
                var localeStringResourceFromDb = await _localeStringResourceService.GetById(mesage.Id);

                if (localeStringResourceFromDb == null)
                {
                    throw new MessageException(ResourceKey.LocaleStringResource_NotFound);
                }
                LocaleStringResource locale = new LocaleStringResource(localeStringResourceFromDb);
                locale.Change(mesage);

                await _localeStringResourceService.ChangeToDb(locale);


                ICommandResult result = new CommandResult
                {
                    Message  = "",
                    ObjectId = locale.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);
            }
        }
        public async Task <CommandResult> SendCommand(LocaleStringResourceChangeCommand command)
        {
            CommandResult commandResult = await _commandService.SendAndReceiveResult <CommandResult>(command);

            return(commandResult);
        }