/// <summary> /// Prints Admin menu /// </summary> /// <param name="admin">Takes a user with admin priviliges</param> public static void PrintAdminSelectionMenu(User admin) { SharedView.PrintWithGreenText($"\tVälkommen {admin.Name}"); var logoutUser = false; do { GeneralViewHelper.WaitAndClearScreen(); AdminView.Print(); string menuInput = InputHelper.AskForMenuInput(); int validatedInput = InputHelper.ValidateMenuInput(menuInput); logoutUser = SharedController.LogoutIf_X_IsPressed(admin, menuInput, validatedInput); if (logoutUser) { continue; } else { switch (validatedInput) { case 1: AdminFunctions(admin); break; case 2: SharedController.BuyBookMenu(admin); break; } } } while (!logoutUser); }
/// <summary> /// First menu that the user see when standard user logs in. /// </summary> /// <param name="user">Takes a user to be connected with eventual purchase.</param> internal static void UserSelectionMenu(User user) { var continueLoop = true; do { UserView.PrintBuyMenuOptions(); var input = SharedController.GetAndValidateInput(); switch (input.validatedInput) { case 1: SharedController.BuyBookMenu(user); break; case 0: if (SharedController.LogoutIf_X_IsPressed( user, input.menuInput, input.validatedInput)) { continueLoop = false; } else { SharedError.PrintWrongMenuInput(); } break; } } while (continueLoop); }