static void Main(string[] args) { Console.WriteLine("Welcome to Address Book"); Console.WriteLine("Select Opertion\n 1: Add New Address Book\n 2: Display Address Book\n 3: Edit Address Book\n 4: Delete Address Book\n 5: Duplicate Address Book\n 6: Search Person By City or State\n 7: View Person By City or State\n 8: Contact person by city and state\n X: Exit"); string Choice = Console.ReadLine(); var userInput = new AddressBookBuilder(); while (true) { switch (Choice) { case "1": Console.WriteLine("Enter Name For Address Book"); AddressBookBuilder.Add(); break; case "2": AddressBookBuilder.DisplayContact(); break; case "3": Console.WriteLine("Enter the Name of Address Book You Want to Edit:"); AddressBookBuilder.Edit(); break; case "4": Console.WriteLine("Enter First Name of Contact To Delete Contact Details"); AddressBookBuilder.Delete(); break; case "5": Console.WriteLine("Enter the Address Book Name:"); AddressBookBuilder.Duplicate(); break; case "6": AddressBookBuilder.Search(); break; case "7": AddressBookBuilder.View(); break; case "8": AddressBookBuilder.Contact(); break; case "X": return; } Console.WriteLine("Select Opertion\n 1: Add New Address Book\n 2: Display Address Book\n 3: Edit Address Book\n 4: Delete Address Book\n 5: Duplicate Address Book\n 6: Search Person By City or State\n 7: View Person By City or State\n 8: Contact person by city and state\n X: Exit"); Choice = Console.ReadLine(); } }
/// <summary> /// Defines the entry point of the application. /// </summary> /// <param name="args">The arguments.</param> static void Main(string[] args) { Console.WriteLine("Welcome to Address Book"); AddressBookBuilder addressBookBuilder = new AddressBookBuilder(); while (true) { Console.WriteLine("1. Add Contact\n2. Display Contacts\n3. Edit Contact \n4. Delete Contact \n5. Exit"); int option = Convert.ToInt32(Console.ReadLine()); switch (option) { case 1: addressBookBuilder.addContact(); break; case 2: addressBookBuilder.displayContacts(); break; case 3: Console.WriteLine("Enter the first name of the contact that need to be changed"); String firstNameSearch = Console.ReadLine(); addressBookBuilder.editContact(firstNameSearch); break; case 4: Console.WriteLine("Enter the first name of the contact that need to be deleted"); String firstName = Console.ReadLine(); addressBookBuilder.deleteContact(firstName); break; case 5: Environment.Exit(0); break; default: Console.WriteLine("Enter Valid Choice"); break; } } }