Пример #1
0
        public bool WithdrawAmount(ICardAccount cardAccount, decimal withdrawValue)
        {
            cardAccount.CardCash = cardAccount.CardCash - withdrawValue;
            if (cardAccount.CardCash < 0)
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        private static bool WithdrawSum(
            AtmEntities dbContext, 
            CardAccountRepository cardAcountRepo,
            TransactionHistoryRepository tarnsactionHystoryRepo, 
            ICardAccount cardAccount)
        {
            var transactionsHandler = new TransactionsHandler(dbContext, cardAcountRepo, tarnsactionHystoryRepo);
            var consoleHandler = ConsoleHandler.Instance;
            consoleHandler.Print("Enter value to withdraw: ");
            var withdrawValueInput = consoleHandler.GetStringInput();
            decimal withdrawValue = new decimal();
            if(!decimal.TryParse(withdrawValueInput, out withdrawValue))
            {
                return false;
            }

            return transactionsHandler.WithdrawTransaction(cardAccount.CardNumber, cardAccount.CardPin, withdrawValue);
        }
Пример #3
0
        private static bool WithdrawSum(
            AtmEntities dbContext,
            CardAccountRepository cardAcountRepo,
            TransactionHistoryRepository tarnsactionHystoryRepo,
            ICardAccount cardAccount)
        {
            var transactionsHandler = new TransactionsHandler(dbContext, cardAcountRepo, tarnsactionHystoryRepo);
            var consoleHandler      = ConsoleHandler.Instance;

            consoleHandler.Print("Enter value to withdraw: ");
            var     withdrawValueInput = consoleHandler.GetStringInput();
            decimal withdrawValue      = new decimal();

            if (!decimal.TryParse(withdrawValueInput, out withdrawValue))
            {
                return(false);
            }

            return(transactionsHandler.WithdrawTransaction(cardAccount.CardNumber, cardAccount.CardPin, withdrawValue));
        }
Пример #4
0
 public bool IsCashAmountSufficient(ICardAccount cardAccount, decimal withdrawValue)
 {
     return(cardAccount.CardCash >= withdrawValue);
 }