public ServiceResult UpdatePhoneService(int phoneNumberID, PhoneNumbers phoneNumber) { using (var context = new ContactBookContext()) { var updatephoneNumber = context.PhoneNumbers.SingleOrDefault(x => x.PhoneNumberID == phoneNumberID); context.Entry(updatephoneNumber).CurrentValues.SetValues(phoneNumber); context.SaveChanges(); return(new ServiceResult(phoneNumberID, true)); } }
public ServiceResult UpdateAddressService(int addressID, Addresses address) { using (var context = new ContactBookContext()) { var updateAddress = context.Addresses.SingleOrDefault(x => x.AddressID == addressID); context.Entry(updateAddress).CurrentValues.SetValues(address); context.SaveChanges(); return(new ServiceResult(addressID, true)); } }
public ServiceResult UpdateEmailService(int emailID, Emails updEmail) { using (var context = new ContactBookContext()) { var updateEmail = context.Emails.SingleOrDefault(x => x.EmailID == emailID); context.Entry(updateEmail).CurrentValues.SetValues(updEmail); context.SaveChanges(); return(new ServiceResult(emailID, true)); } }
public ServiceResult Update(int id, Contact updContact) { using (var context = new ContactBookContext()) { var updateContact = context.Contacts.Include(f => f.Addresses).Include(f => f.PhoneNumbers).Include(f => f.Emails).SingleOrDefault(x => x.Id == id); context.Entry(updateContact).CurrentValues.SetValues(updContact); context.SaveChanges(); return(new ServiceResult(id, true)); } }
public void UpdateCategory(Category entity) { _dbContext.Entry(entity).State = EntityState.Modified; }
public void UpdateContact(Contact entity) { _dbContext.Entry(entity).State = EntityState.Modified; }