Ejemplo n.º 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");
        }
Ejemplo n.º 2
0
        public bool HasLoan(int clientId)
        {
            double result = SqlQueries.GetLoanAmount(clientId);

            return(result != 0);
        }