Exemplo n.º 1
0
        public async Task SetCreditAsync(decimal amountOfCredit, decimal annualLendingRate, int lifeOfLoan)
        {
            _newParams = true;
            var credit = await _repository.GetCreditAsync();

            if (credit != null)
            {
                if (credit.AmountOfCredit == amountOfCredit &&
                    credit.AnnualLendingRate == annualLendingRate &&
                    credit.LifeOfLoan == lifeOfLoan)
                {
                    _newParams = false;
                    return;
                }
            }

            await _repository.ClearAsync();

            await _repository.SetCreditAsync(new Credit {
                AmountOfCredit    = amountOfCredit,
                AnnualLendingRate = annualLendingRate,
                LifeOfLoan        = lifeOfLoan
            });
        }