Esempio n. 1
0
 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));
     }
 }
Esempio n. 2
0
 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));
     }
 }
Esempio n. 3
0
 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));
     }
 }
Esempio n. 4
0
 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));
     }
 }
Esempio n. 5
0
 public void UpdateCategory(Category entity)
 {
     _dbContext.Entry(entity).State = EntityState.Modified;
 }
Esempio n. 6
0
 public void UpdateContact(Contact entity)
 {
     _dbContext.Entry(entity).State = EntityState.Modified;
 }