public LongTermExpenseDto(LongTermExpense expense) { Check.NotNull(expense, nameof(expense)); LongTermExpenseId = expense.EntityId; Name = expense.GetName(); ExecutionDay = expense.GetExecutionDay(); StartingDate = expense.GetStartingDate(); EffectiveDate = expense.GetEffectiveDate(); Amount = expense.GetMoney().GetAmount(); Currency = expense.GetMoney().GetCurrency(); }
public async Task <Unit> Handle(UpdateLongTermExpenseCommand command, CancellationToken cancellationToken) { var longTermExpense = await _repository.GetLongTermExpenseById(command.LongTermExpenseId); var update = new LongTermExpense(longTermExpense.PredictionId, command.Name, command.StartingDate, command.EffectiveDate, command.ExecutionDay, new Money(command.Amount, command.Currency)); longTermExpense.Update(update); _repository.UpdateLongTermExpense(longTermExpense); await _repository.SaveAsync(); return(Unit.Value); }
public void UpdateLongTermExpense(LongTermExpense longTermExpense) { _db.LongTermExpenses.Update(longTermExpense); }