private MenuOptionResult Login()
        {
            API_User user = null;

            while (user == null)
            {
                LoginUser loginUser = new LoginUser();
                loginUser.Username = GetString("Username: "******"Login cancelled.");
                    return(MenuOptionResult.WaitAfterMenuSelection);
                }

                loginUser.Password = GetPasswordFromConsole("Password: ");
                user = authService.Login(loginUser);
                if (user == null)
                {
                    consoleServices.ErrorMessage();
                }
            }
            UserService.SetLogin(user);

            // User is logged in, show the main menu now.
            return(new MainMenu(user).Show());
        }
예제 #2
0
        private MenuOptionResult ViewTransfers()
        {
            TransferApiDao             tran = new TransferApiDao(API_BASE_URL, User);
            Dictionary <int, Transfer> list = tran.GetTransfers();

            consoleServices.PrintTransfers(list, User);

            int transId = GetInteger("\n\nTo view more details, input transfer ID #: ", 0);

            while (transId != 0)
            {
                while (!list.ContainsKey(transId))
                {
                    consoleServices.ErrorMessage();
                    transId = GetInteger("To view more details, input transfer ID #: ", 0);
                }

                consoleServices.TransferDetails(list[transId], User);
                transId = GetInteger("To view more details, input transfer ID #: ", 0);
            }

            return(MenuOptionResult.DoNotWaitAfterMenuSelection);
        }