public void AddContact(PhoneContact contact) { var maxId = _phoneContacts.Count > 0 ? _phoneContacts.Max(x => x.Id) : 0; contact.Id = maxId + 1; _phoneContacts.Add(contact); SaveChanges(); }
public void UpdateContact(PhoneContact contact) { var existingContact = _phoneContacts.First(x => x.Id == contact.Id); existingContact.Name = contact.Name; existingContact.Phone = contact.Phone; SaveChanges(); }
public List <PhoneContact> UpdateContact(PhoneContact phoneContact) { _contactsHandler.UpdateContact(phoneContact); return(_contactsHandler.GetPhoneContacts()); }