Exemplo n.º 1
0
 public ShortTermExpenseDto(ShortTermExpense expense)
 {
     ShortTermExpenseId = expense.EntityId;
     Name          = expense.GetName();
     ExecutionDate = expense.GetExecutionDate();
     Amount        = expense.GetMoney().GetAmount();
     Currency      = expense.GetMoney().GetCurrency();
 }
        public async Task <Unit> Handle(UpdateShortTermExpenseCommand command, CancellationToken cancellationToken)
        {
            var shortTermExpense = await _repository.GetShortTermExpenseById(command.ShortTermExpenseId);

            var update = new ShortTermExpense(shortTermExpense.PredictionId, command.Name, command.ExecutionDate,
                                              new Money(command.Amount, command.Currency));

            shortTermExpense.Update(update);
            _repository.UpdateShortTermExpense(shortTermExpense);
            await _repository.SaveAsync();

            return(Unit.Value);
        }
Exemplo n.º 3
0
 public void UpdateShortTermExpense(ShortTermExpense shortTermExpense)
 {
     _db.ShortTermExpenses.Update(shortTermExpense);
 }