private void EditButton_Click(object sender, RoutedEventArgs e) { ReadOnly = !ReadOnly; EditingLabel.Visibility = ReadOnly ? Visibility.Collapsed : Visibility.Visible; if (ReadOnly) { var r = MessageBox.Show("Are you sure you wish to make changes to the company? This cannot be undone.", "Are you sure?", MessageBoxButton.OKCancel); if (r == MessageBoxResult.OK) { var dataCompany = (DataCompany)DataContext; dataCompany.ABN = TextboxABN.Text; dataCompany.CompanyName = TextboxCompanyName.Text; dataCompany.OfficeNumber = TextboxOfficeNumber.Text; dataCompany.Email = TextboxEmail.Text; CompanyHelper.SaveChanges(dataCompany); } } }
private void SaveAllButton_Click(object sender, RoutedEventArgs e) { CompanyHelper.SaveChanges((DataCompany)DataContext); }