Beispiel #1
0
        public static void ProcessDeposit(string accountNumber, int transactionType)
        {
            int     transactionId = TransactionATMController.CreateTransactionConsole(accountNumber, transactionType);
            decimal amount        = GetDepositAmountFromUser();

            DepositCreateModel newDeposit = new DepositCreateModel
            {
                Amount        = amount,
                TransactionID = transactionId
            };

            depositService.CreateDeposit(newDeposit);

            decimal deposit    = newDeposit.Amount;
            decimal newBalance = accountService.AddDepositToBalance(accountNumber, deposit);

            accountService.SaveNewBalanceToDatabase(accountNumber, newBalance);
        }
Beispiel #2
0
        public static void ProcessWithdrawal(string accountNumber, int transactionType)
        {
            int     transactionId = TransactionATMController.CreateTransactionConsole(accountNumber, transactionType);
            decimal amount        = GetWithdrawalAmountFromUser();

            WithdrawalCreateModel newWithdrawal = new WithdrawalCreateModel
            {
                Amount        = amount,
                TransactionID = transactionId
            };

            withdrawalService.CreateWithdrawal(newWithdrawal);

            decimal withdrawal = newWithdrawal.Amount;
            decimal newBalance = accountService.SubtractWithdrawalFromBalance(accountNumber, withdrawal);

            accountService.SaveNewBalanceToDatabase(accountNumber, newBalance);
        }