Beispiel #1
0
        public void RunCLI()
        {
            while (true)
            {
                ViewAllParks();
                string parkName = CLIHelper.GetString("Please enter a park name: ");

                Console.WriteLine();
                if (parkName.ToLower() == "q")
                {
                    break;
                }

                if (!validParkNames.Contains(parkName.ToUpper()))
                {
                    Console.WriteLine("No campsites found for given Park Names. Please enter a valid park name.");
                    continue;
                }


                Park park = GetParkInfo(parkName);

                campgroundCLI.RunCampgroundCLI(park);
            }
            Console.WriteLine("Thank you for using the National Park Campsite Reservation System");
        }
        public void RunCLI()
        {
            PrintHeader();
            PrintMenu();

            while (true)
            {
                string command = Console.ReadLine();

                Console.Clear();

                if (command.ToLower() == "q")
                {
                    Console.WriteLine("Thank you for using the campground reservation system");
                    return;
                }
                else if (int.Parse(command) <= numParks && int.Parse(command) > 0)
                {
                    CampgroundCLI cli = new CampgroundCLI(int.Parse(command));
                    cli.RunCampgroundCLI();
                }
                else
                {
                    Console.WriteLine("The command provided was not a valid command, please try again.");
                    break;
                }

                PrintMenu();
            }
        }