internal static void UpdateContact(int id) { if (id == 0) { return; } else if (ContactList.ContainsKey(id)) { do { Console.Clear(); ContactModel c = GetContactFromList(id); ConsoleLogging.PrintContactInfo(id, c); Console.WriteLine("What do you want to update?"); string propertyToUpdate = Console.ReadLine(); UpdateProperty(c, propertyToUpdate); } while (ConsoleLogging.UpdateAgain()); } else { ConsoleLogging.ContactDoesNotExist(); } }
private static ContactModel GetContactFromList(int id) { ContactModel c; while (!ContactList.TryGetValue(id, out c)) { ConsoleLogging.ContactDoesNotExist(); id = ConsoleLogging.GetContactToUpdate(); } return(c); }