/// <summary> /// Adds the or access address book. /// </summary> public void AddOrAccessAddressBook() { AddressBook addressBook = GetAddressBook(); // Condition to check whether the address book returned by the Get address book function returns a null if (addressBook == null) { Console.WriteLine("Action aborted"); return; } Outer: Console.WriteLine("******************************************"); Console.WriteLine("Welcome to the {0}'s Address Book", addressBookName.ToUpper()); Console.WriteLine("******************************************"); Console.WriteLine("1. Create A New Contact"); Console.WriteLine("2. Edit a contact"); Console.WriteLine("3. Delete a contact"); Console.WriteLine("4. Display Stored Contact"); Console.WriteLine("5. Display Contact Name as per State"); Console.WriteLine("6. Display Contact Name as per City"); Console.WriteLine("7. Display Count of contact as per State"); Console.WriteLine("8. Display Count of contact as per City"); Console.WriteLine("9. Handle File Input Output Operation"); Console.WriteLine("Press any Key to Exit!!!!!!!"); switch (Convert.ToInt32(Console.ReadLine().ToLower())) { case ADD_CONTACT: addressBook.AddContact(); break; case EDIT_CONTACT: addressBook.EditContactDetails(); break; case GET_ALL_CONTACTS: addressBook.DisplayDetails(); break; case DELETE_CONTACT: addressBook.DeleteDetails(); break; case GET_ALL_CONTACTS_BY_STATE: addressBook.DisplayByState(); break; case GET_ALL_CONTACTS_BY_CITY: addressBook.DisplayByCity(); break; case GET_COUNT_BY_STATE: addressBook.DisplayCountByState(); break; case GET_COUNT_BY_CITY: addressBook.DisplayCountByCity(); break; case FILE_IO: FileReadWriteClass.GuidanceToFileIO(addressBook); break; default: Console.WriteLine("\nInvalid option. Exiting from the address book"); return; } Console.WriteLine("\nType y to continue in same address Book or any other key to exit"); if (!(Console.ReadLine().ToLower() == "y")) { return; } else { goto Outer; } }