예제 #1
0
        private static void Transaction()
        {
            Account  account   = new Account();
            Transfer transfers = new Transfer();

            try
            {
                int recipient = CLIHelper.GetInteger("Enter id of user you are trying to send to: ");
                account = api.GetAccounts(recipient);

                if (recipient == 0 || account == null)
                {
                    MenuSelection();
                }
                else
                {
                    double amount = CLIHelper.GetDouble("Enter amount: ");

                    if (amount > api.GetBalance().Balance)
                    {
                        Console.WriteLine("Insufficient funds. Please try again.");
                        Transaction();
                    }
                    else
                    {
                        account.Balance -= amount;
                        api.GetTransactions(recipient, transfers.AccountFrom, transfers.AccountTo);
                        Console.WriteLine("Your transfer has been approved!");
                        MenuSelection();
                    }
                }
            }
            catch (Exception e)
            {
            }
        }