예제 #1
0
        public Task <bool> Handle(RemoveEmpregadoCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(Task.FromResult(false));
            }
            _empregadoRepository.Remove(message.Id);

            if (Commit())
            {
                Bus.RaiseEvent(new EmpregadoRemovedEvent(message.Id));
            }

            return(Task.FromResult(true));
        }
예제 #2
0
        public void Remove(Guid id)
        {
            var removeCommand = new RemoveEmpregadoCommand(id);

            Bus.SendCommand(removeCommand);
        }