/// <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) { string countryCode; switch (choice) { case "1": // List Countries // Show user a list of items available ListCountries(); Pause(""); return true; case "2": // List Countries on a continent string continent = GetString("Enter the Continent Name: "); ListCountries(continent); Pause(""); return true; case "3": // Show the Country sub-menu countryCode = GetString("Enter the Country Code: "); // TODO: Lookup the country (GetCountryByCode) and pass that into the country submenu Country country = null; if (country == null) { Pause($"Sorry, country '{countryCode}' does not exist."); return true; } // TODO: Code was found, invoke the Country menu CountryMenu menu = new CountryMenu(country); menu.Run(); return true; } 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) { string countryCode; switch (choice) { case "1": // List Countries // Show user a list of items available ListCountries(); Pause(""); return(true); case "2": // List Countries on a continent string continent = GetString("Enter the Continent Name: "); ListCountries(continent); Pause(""); return(true); case "3": // Show the Country sub-menu countryCode = GetString("Enter the Country Code: "); Country country = countryDAO.GetCountryByCode(countryCode); if (country == null) { Pause($"Sorry, country '{countryCode}' does not exist."); return(true); } // Code was found, invole the Country menu CountryMenu menu = new CountryMenu(country, cityDAO, countryDAO, languageDAO); menu.Run(); return(true); } return(true); }
private MenuOptionResult SelectACountry() { string countryCode = GetString("Enter the Country Code: "); // TODO 08: Lookup the country (GetCountryByCode) and pass that into the country submenu Country country = countryDAO.GetCountry(countryCode); if (country == null) { Console.WriteLine($"Sorry, country '{countryCode}' does not exist."); return(MenuOptionResult.WaitAfterMenuSelection); } // Code was found, invoke the Country menu // TODO 09: Pass countryDAO into country menu. We are going to need a CityDAO also! CountryMenu menu = new CountryMenu(country); menu.Show(); return(MenuOptionResult.DoNotWaitAfterMenuSelection); }