Beispiel #1
0
        public static void Menu5()
        {
            string prompt = "Use the arrow keys to cycle through options and press Enter to select the option";

            string[] options       = { "Return another book", "Return to Main Menu" };
            Menu     secondaryMenu = new Menu(prompt, options);
            int      selectedIndex = secondaryMenu.Run();

            switch (selectedIndex)
            {
            case 0:
                BookRental.ReturnBook();
                break;

            case 1:
                RunMainMenu();
                break;
            }
        }
Beispiel #2
0
        public static void RunMainMenu()
        {
            string prompt = "Use the arrow keys to cycle through options and press Enter to select the option";

            string[] options       = { "Add a new book", "Display all the books in the library", "Check the availability of a book", "Rent a book", "Return a book", "Exit app" };
            Menu     mainMenu      = new Menu(prompt, options);
            int      selectedIndex = mainMenu.Run();

            switch (selectedIndex)
            {
            case 0:
                Clear();
                AddBook();
                break;

            case 1:
                Clear();
                GetAllBooks();
                break;

            case 2:
                Clear();
                NumberOfBooks();
                break;

            case 3:
                Clear();
                RentBook();
                break;

            case 4:
                Clear();
                BookRental.ReturnBook();
                break;

            case 5:
                ExitApp();
                break;
            }
        }