Exemplo n.º 1
0
        public Task <CommandResult> Handle(RemoveChequeCommand command, CancellationToken cancellationToken)
        {
            if (!command.IsValid())
            {
                NotifyCommandErrors(command);
                return(Response());
            }

            Cheque cheque = _chequeRepository.GetById(command.Id);

            _chequeRepository.Remove(cheque);

            if (Commit())
            {
                _mediator.Publish(new RemovedChequeEvent());
            }

            return(Response());
        }