Example #1
0
        public LongTermIncomeDto(LongTermIncome income)
        {
            Check.NotNull(income, nameof(income));

            LongTermIncomeId = income.EntityId;
            Name             = income.GetName();
            ExecutionDay     = income.GetExecutionDay();
            StartingDate     = income.GetStartingDate();
            EffectiveDate    = income.GetEffectiveDate();
            Amount           = income.GetMoney().GetAmount();
            Currency         = income.GetMoney().GetCurrency();
        }
        public async Task <Unit> Handle(UpdateLongTermIncomeCommand command, CancellationToken cancellationToken)
        {
            var longTermIncome = await _repository.GetLongTermIncomeById(command.LongTermIncomeId);

            var update = new LongTermIncome(longTermIncome.PredictionId, command.Name, command.StartingDate,
                                            command.EffectiveDate, command.ExecutionDay, new Money(command.Amount, command.Currency));

            longTermIncome.Update(update);
            _repository.UpdateLongTermIncome(longTermIncome);
            await _repository.SaveAsync();

            return(Unit.Value);
        }
Example #3
0
 public void UpdateLongTermIncome(LongTermIncome longTermIncome)
 {
     _db.LongTermIncomes.Update(longTermIncome);
 }