public async Task <IList <Transaction> > getAllFarmTransaction(int userId) { var transaction = await _transactionRepos.getAllFarmTransaction(userId); foreach (var i in transaction) { i.Sender = _premisesRepos.GetById(i.SenderId); i.Receiver = _premisesRepos.GetById(i.ReceiverId); i.TransactionStatus = _transactionStatusRepos.GetById(i.StatusId); i.Food = _foodRepos.GetById(i.FoodId); i.Food.Category = _categoryRepos.GetById(i.Food.CategoryId); } return(transaction); }
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 TransactionStatusViewModel GetById(Guid id) { return(_mapper.Map <TransactionStatusViewModel>(_TransactionStatusRepository.GetById(id))); }