public void ValidateAddDeposit(CreatedDepositDTO createdDepositDTO)
 {
     if (!IsValidInterestRate(createdDepositDTO))
     {
         throw new InvalidDataDTOException("Invalid interest rate");
     }
 }
        public ActionResult AddDeposit([FromBody] CreatedDepositDTO newDepositr)
        {
            logger.LogInformation($"Call AddDeposit with Name: {newDepositr.Name}, Interes rate: {newDepositr.InterestRate}");

            depositsManager.AddDeposit(newDepositr);
            return(Ok());
        }
Example #3
0
        public void AddDeposit(CreatedDepositDTO newDeposit)
        {
            logger.LogInformation($"Call AddDeposit");

            validateService.ValidateAddDeposit(newDeposit);

            var deposit = new Deposit
            {
                Id           = GetIDForNewDeposit(),
                Name         = newDeposit.Name,
                InterestRate = newDeposit.InterestRate,
            };

            depositsRepository.AddDeposit(deposit);
        }
 private bool IsValidInterestRate(CreatedDepositDTO createdDepositDTO) => createdDepositDTO.InterestRate >= 0.01m;