public Task <bool> Handle(RegisterNewTransactionStatusCommand message, CancellationToken cancellationToken) { if (!message.IsValid()) { NotifyValidationErrors(message); return(Task.FromResult(false)); } var transactionType = new TransactionStatus(message.Id, message.Name); if (_transactionStatusRepository.GetByName(message.Name) != null) { Bus.RaiseEvent(new DomainNotification(message.MessageType, "The transactionType name has already been taken.")); return(Task.FromResult(false)); } _transactionStatusRepository.Add(transactionType); if (Commit()) { Bus.RaiseEvent(new TransactionStatusRegisteredEvent(transactionType.Id, transactionType.Name)); } return(Task.FromResult(true)); }
public TransactionStatus GetItemStatus(string configName) { // pegar informacoes do status TransactionStatus itemStatus = _transactionStatusRepository .GetByName(configName); return(itemStatus); }
public TransactionStatusViewModel GetByName(string name) { return(_mapper.Map <TransactionStatusViewModel>(_TransactionStatusRepository.GetByName(name))); }