private void RecoverContact(Contact contact) { FlowDocument document = contact.NotesDocument; contact.SaveChangesToDisk = true; contact.NotesDocument = document; ContactDatabase.UpdateContact(contact); new RecoveryDatabase(RecoveryVersion.LastRun).RecoveryContact = null; if (peopleView != null) { peopleView.UpdateContact(contact); } PeoplePeekContent.UpdateAll(contact); }
public async void OnAdd(object function) { ContactDatabase db = new ContactDatabase(dbPath); if (CheckFields()) { switch (function) { case "Add": var Contact = new Contact() { EmergencyName = emergencyName, ContactName = contactName, ContactNumber = contactNumber }; // DependencyService.Get<IToast>().Toasts("custom",emergency); DependencyService.Get <IToast>().Toasts("addContact", db.AddContact(Contact)); ContactName = ""; ContactNumber = ""; MessagingCenter.Send <App>((App)Application.Current, "OnContactAdded"); break; case "Update": var UpdateContact = await db.GetContactAsync(emergencyName, contactId); UpdateContact.ContactName = contactName; UpdateContact.ContactNumber = contactNumber; DependencyService.Get <IToast>().Toasts("updateContact", db.UpdateContact(UpdateContact)); MessagingCenter.Send <App>((App)Application.Current, "OnContactUpdated"); await PopupNavigation.Instance.PopAsync(true); break; } } else { DependencyService.Get <IToast>().Toasts("addContact", "failed"); } }
// PUT api/Contact/5 public void Put(int id, string firstName, string lastName, string email, int phnNum) { ContactDatabase contactDatabase = new ContactDatabase(); contactDatabase.UpdateContact(id, firstName, lastName, email, phnNum); }