protected override bool ExecuteSelection(string choice) { int choiceInt = 0; if (int.TryParse(choice, out choiceInt)) { // Check if selection is within the range of menu options if (choiceInt <= parkList.Count && choiceInt > 0) { ParkInformationMenu menu = new ParkInformationMenu(this.campgroundDAO, this.reservationDAO, this.parkList[choiceInt - 1]); menu.Run(); return(true); } } Console.WriteLine("Invalid input, press any key to try again."); Console.ReadKey(); return(true); }
/// <summary> /// The override of ExecuteSelection handles whatever selection was made by the user. /// This is where any business logic is executed. /// </summary> /// <param name="choice">"Key" of the user's menu selection</param> /// <returns></returns> protected override bool ExecuteSelection(string choice) { parkList = parkdao.GetParks(); switch (choice) { case "1": ParkInformationMenu parkInfoMenu = new ParkInformationMenu(parkdao, campgroundDAO, reservationDAO, siteDAO, parkList[0]); parkInfoMenu.Run(); return(true); case "2": parkInfoMenu = new ParkInformationMenu(parkdao, campgroundDAO, reservationDAO, siteDAO, parkList[1]); parkInfoMenu.Run(); return(true); case "3": parkInfoMenu = new ParkInformationMenu(parkdao, campgroundDAO, reservationDAO, siteDAO, parkList[2]); parkInfoMenu.Run(); return(true); } return(true); }