Beispiel #1
0
        /// <summary>
        /// Get loan
        /// </summary>
        /// <param name="client"></param>
        /// <param name="amount"></param>
        public void GetLoan(int clientId, double amount)
        {
            double fundsAvailable = SqlQueries.GetFundsAmount(clientId);

            double loanAmount = SqlQueries.GetLoanAmount(clientId);
            double newAmount  = fundsAvailable + amount;

            SqlQueries.ChangeFundsAmount(clientId, newAmount);
            SqlQueries.GetLoan(clientId, amount + loanAmount);

            Transaction?.Invoke(clientId, $"{GetClientNameById(clientId)} got a ${amount} loan");
        }
Beispiel #2
0
        public bool HasLoan(int clientId)
        {
            double result = SqlQueries.GetLoanAmount(clientId);

            return(result != 0);
        }