public Task <bool> Handle(RemoveTransactionStatusCommand message, CancellationToken cancellationToken) { if (!message.IsValid()) { NotifyValidationErrors(message); return(Task.FromResult(false)); } TransactionStatus transactionStatus = _transactionStatusRepository.GetById(message.Id); if (transactionStatus == null) { // notificar o dominio Bus.RaiseEvent(new DomainNotification(message.MessageType, "Registro não encontrado")); return(Task.FromResult(false)); } _transactionStatusRepository.Remove(message.Id); if (Commit()) { Bus.RaiseEvent(new TransactionStatusRemovedEvent(message.Id)); } return(Task.FromResult(true)); }
public void Remove(Guid id) { var removeCommand = new RemoveTransactionStatusCommand(id); Bus.SendCommand(removeCommand); }