Esempio n. 1
0
        public override void Run(bool clearScreen = true)
        {
            if (clearScreen)
            {
                Console.Clear();
            }
            Console.WriteLine($"Deposit for {User.Username}\n");
            Console.Write("Enter amount to deposit: ");
            var amount = UserInputHelper.GetDecimal();

            Console.Write($"Depost {amount:C}. Are you sure? (y/n) : ");
            var confirm = Console.ReadLine();

            if (confirm == "y" || confirm == "Y")
            {
                var res = UserTransactionService.Deposit(User.Id, amount);
                if (res.Success)
                {
                    Console.WriteLine("Deposit Success!");
                }
                else
                {
                    Console.WriteLine($"Deposit Failed. {res.Errors}");
                }
            }
            else
            {
                Console.WriteLine("Deposit Cancelled!");
            }
            ShowDoneOptions();
        }
        public override void Run(bool clearScreen = true)
        {
            if (clearScreen)
            {
                Console.Clear();
            }
            Console.WriteLine($"Withdrawal for {User.Username}");
            Console.WriteLine($"Availabe for withdrawal: {UserTransactionService.GetCurrentBalanceForUser(User.Id):C}\n");

            Console.Write("Enter amount to withdraw: ");
            var amount = UserInputHelper.GetDecimal();

            Console.Write($"Withdraw {amount:C}. Are you sure? (y/n) : ");
            var confirm = Console.ReadLine();

            if (confirm == "y" || confirm == "Y")
            {
                var res = UserTransactionService.Withdraw(User.Id, amount);
                if (res.Success)
                {
                    Console.WriteLine("Withdrawal Success!");
                }
                else
                {
                    Console.WriteLine($"Withdrawal Failed. {res.Errors}");
                }
            }
            else
            {
                Console.WriteLine("Withdrawal Cancelled!");
            }
            ShowDoneOptions();
        }