コード例 #1
0
 public ShortTermExpenseDto(ShortTermExpense expense)
 {
     ShortTermExpenseId = expense.EntityId;
     Name          = expense.GetName();
     ExecutionDate = expense.GetExecutionDate();
     Amount        = expense.GetMoney().GetAmount();
     Currency      = expense.GetMoney().GetCurrency();
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 public void UpdateShortTermExpense(ShortTermExpense shortTermExpense)
 {
     _db.ShortTermExpenses.Update(shortTermExpense);
 }