Example #1
0
        public void UpdateInDatabase(int id, ContactEntity contactEntity)
        {
            if (contactEntity == null)
            {
                throw new ArgumentNullException(nameof(contactEntity));
            }

            var contact = contactEntity.ToModel();

            using (var ipPhoneEntities = new IPPhoneEntities())
            {
                ipPhoneEntities.SaveChanges();
            }
        }
Example #2
0
        public void CreateInDatabase(ContactEntity contactEntity)
        {
            if (contactEntity == null)
            {
                throw new ArgumentNullException(nameof(contactEntity));
            }

            var contact = contactEntity.ToModel();

            contact.Id = Guid.NewGuid();


            using (var ipPhoneEntities = new IPPhoneEntities())
            {
                ipPhoneEntities.Contacts.Add(contact);
                ipPhoneEntities.SaveChanges();
            }
        }