Exemple #1
0
        public void AddContact(PhoneContact contact)
        {
            var maxId = _phoneContacts.Count > 0 ? _phoneContacts.Max(x => x.Id) : 0;

            contact.Id = maxId + 1;

            _phoneContacts.Add(contact);
            SaveChanges();
        }
Exemple #2
0
        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());
        }