Example #1
0
        public Task <bool> Handle(RemoverAlunoCommand message, CancellationToken cancellationToken)
        {
            if (!message.IsValid())
            {
                NotifyValidationErrors(message);
                return(Task.FromResult(false));
            }

            _alunoRepository.Remove(message.Id);

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

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

            Bus.SendCommand(removeCommand);
        }