예제 #1
0
        public ShortTermIncomeDto(ShortTermIncome income)
        {
            Check.NotNull(income, nameof(income));

            ShortTermIncomeId = income.EntityId;
            Name          = income.GetName();
            ExecutionDate = income.GetExecutionDate();
            Amount        = income.GetMoney().GetAmount();
            Currency      = income.GetMoney().GetCurrency();
        }
예제 #2
0
        public async Task <Unit> Handle(UpdateShortTermIncomeCommand command, CancellationToken cancellationToken)
        {
            var shortTermIncome = await _repository.GetShortTermIncomeById(command.ShortTermIncomeId);

            var update = new ShortTermIncome(shortTermIncome.PredictionId, command.Name,
                                             command.ExecutionDate, new Money(command.Amount, command.Currency))
            {
                EntityId = command.ShortTermIncomeId
            };

            shortTermIncome.Update(update);
            _repository.UpdateShortTermIncome(shortTermIncome);
            await _repository.SaveAsync();

            return(Unit.Value);
        }
 public void UpdateShortTermIncome(ShortTermIncome income)
 {
     _db.Update(income);
 }