示例#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));
     }
 }
示例#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));
     }
 }
示例#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));
     }
 }
示例#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));
     }
 }
示例#5
0
 public void UpdateCategory(Category entity)
 {
     _dbContext.Entry(entity).State = EntityState.Modified;
 }
示例#6
0
 public void UpdateContact(Contact entity)
 {
     _dbContext.Entry(entity).State = EntityState.Modified;
 }