private void toolBar_btnSave_Click(object sender) { //Abhi> in Brillo, add logic to add for validations if (ContactDB.SaveChanges() > 0) { toolBar.msgSaved(ContactDB.NumberOfRecords); contactViewSource.View.Refresh(); } }
private void btnSave_Click(object sender) { if (dbContext.SaveChanges() > 0) { toolBar.msgSaved(dbContext.NumberOfRecords); } }
public void Save_Click(object sender) { if (_contact.State == EntityState.Added) { ContactdbContext.contacts.Add(_contact); } _contact.IsSelected = true; IEnumerable <DbEntityValidationResult> validationresult = ContactdbContext.GetValidationErrors(); if (validationresult.Count() == 0) { try { ContactdbContext.SaveChanges(); } catch (Exception ex) { throw ex; } crud_modal.Children.Clear(); crud_modal.Visibility = System.Windows.Visibility.Collapsed; contactComboBox.Text = _contact.name; } else { MessageBox.Show("error"); } }
public HttpResponseMessage EditContact([FromBody] Contact contact) { if (contact == null) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } else { var ContactInDb = _contactDb.Contacts.Where(x => x.Id == contact.Id).SingleOrDefault(); if (contact == null) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } ContactInDb.FirstName = contact.FirstName; ContactInDb.LastName = contact.LastName; ContactInDb.PhoneNumber = contact.PhoneNumber; ContactInDb.Status = contact.Status; } _contactDb.SaveChanges(); return(new HttpResponseMessage(HttpStatusCode.OK)); }
private void btnSave_MouseUp(object sender, RoutedEventArgs e) { entity.contact contact = contactViewSource.View.CurrentItem as entity.contact; //This is helpful when we want to Automate the search of contact when saving is done. if (contact != null) { ContactName = contact.name; if (btnSave_Click != null) { btnSave_Click(sender); } } if (ContactDB.SaveChanges() == 0) { MessageBox.Show("Saving Error"); } btnCancel_MouseDown(null, null); }