private void EditContact(ContactRepo repository, List <Contact> contacts, int editId) { Console.WriteLine("#######################################"); Console.WriteLine("###### Edit contact with id {0} ######", editId); Contact editedContact = new Contact(); foreach (var contact in contacts) { if (contact.Id == editId) { editedContact.ParentUserId = contact.ParentUserId; Console.Clear(); Console.Write("#### Old First Name : "); Console.WriteLine(contact.FirstName); Console.Write("#### New First Name : "); editedContact.FirstName = Console.ReadLine(); Console.Clear(); Console.Write("#### Old Last Name : "); Console.WriteLine(contact.LastName); Console.Write("#### New Last Name : "); editedContact.LastName = Console.ReadLine(); Console.Clear(); Console.Write("#### Old Email : "); Console.WriteLine(contact.Email); Console.Write("#### New Email : "); editedContact.Email = Console.ReadLine(); Console.Write("#### Old Phone : "); Console.WriteLine(contact.Phone); Console.Write("#### New Phone : "); editedContact.Phone = Console.ReadLine(); repository.Edit(editId, editedContact); Console.Clear(); Console.WriteLine("#########################"); Console.WriteLine("####### D O N E ! #######"); Console.WriteLine("#########################"); Thread.Sleep(1000); } } }