public void Init(RoleChangeCommand mesage) { Id = mesage.Id; Name = mesage.Name; Status = mesage.Status; DepartmentId = mesage.DepartmentId; }
public async Task <ICommandResult> Handle(RoleChangeCommand mesage) { try { Role role = new Role(); role.Init(mesage); await _roleService.ChangeToDb(role); await _eventSender.Notify(role.Events); ICommandResult result = new CommandResult { Message = "", ObjectId = role.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(RoleChangeCommand command) { return(await _commandService.SendAndReceiveResult <CommandResult>(command)); }