static void Main(string[] args) { Console.WriteLine("Welcome to the Countries Maintence Application!"); while (true) { var userSelectionApp = new CountriesApp(); var userSelection = userSelectionApp.PickCountry(); if (!Validation.SelectionValidation(userSelection)) { Console.WriteLine("Enter a number 1-3"); continue; } else if (Validation.SelectionValidation(userSelection) && userSelection == "1") { CountriesTextFile.WriteCountries(); CountriesTextFile.ReadCountries(); } else if (Validation.SelectionValidation(userSelection) && userSelection == "2") { CountriesTextFile.AddCountry(); } else if (Validation.SelectionValidation(userSelection) && userSelection == "3") { break; } } Console.ReadKey(); }
static void Main(string[] args) { var directoryPath = CountriesTextFile.CheckCountriesTextFile(); CountriesApp.Greeting(); bool keepGoing = true; while (keepGoing) { int choice = CountriesApp.GetUserChoice(); if (choice == 1) { CountriesTextFile.ReadCountries(directoryPath); } else if (choice == 2) { string country = ""; Console.Write("Enter country: "); country = Validator.CountryChoice(); CountriesTextFile.WriteCountries(directoryPath, country); Console.WriteLine("The country has been saved!"); } else if (choice == 3) { string country = Validator.CountryInList(directoryPath); CountriesTextFile.DeleteCountry(directoryPath, country); Console.WriteLine("Country deleted!"); } else if (choice == 4) { Console.WriteLine("Goodbye!"); keepGoing = false; } else { Console.WriteLine("That isn't a valid option, please enter a menu choice."); } } Console.ReadKey(); }