public async Task <ICommandResult> Handle(WardUpdateCommand mesage)
        {
            try
            {
                Ward ward = new Ward();
                ward.Init(mesage);
                await _locationService.UpdateWard(ward);

                ICommandResult result = new CommandResult()
                {
                    Message  = "",
                    ObjectId = ward.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);
            }
        }
Exemple #2
0
 public void Init(WardUpdateCommand command)
 {
     Id             = command.Id;
     Prefix         = command.Prefix;
     DistrictId     = command.DistrictId;
     WardName       = command.WardName;
     WardNameEN     = command.WardNameEN;
     Status         = EnumDefine.CommonStatusEnum.Active;
     ShortName      = command.ShortName;
     Priority       = 0;
     Latitude       = command.Latitude;
     Longitude      = command.Longitude;
     UpdatedDateUtc = command.UpdatedDateUtc;
     CreatedDateUtc = new DateTime(2018, 03, 14, 11, 46, 02);
     CreatedUid     = "";
     UpdatedUid     = command.UpdatedUid;
 }
Exemple #3
0
        public async Task <CommandResult> SendCommand(WardUpdateCommand command)
        {
            CommandResult commandResult = await _commandService.SendAndReceiveResult <CommandResult>(command);

            return(commandResult);
        }