private void btnEdit_Click(object sender, RoutedEventArgs e) { if (tabSelect.SelectedIndex == 0) { if (dtgRentees.SelectedIndex != -1) { EditRentee windowOne = new EditRentee(dtgRentees.SelectedItem as Rentee); if (windowOne.ShowDialog() == true) { FillRenteeList(); } } else { MessageBox.Show("You must select a rentee first", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } else if (tabSelect.SelectedIndex == 1) { if (dtgBikes.SelectedIndex != -1) { EditBike windowTwo = new EditBike(dtgBikes.SelectedItem as Bike); if (windowTwo.ShowDialog() == true) { FillBikeList(); } } else { MessageBox.Show("You must select a bike first", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { if (BikesSelected) { EditBike dialog = new EditBike(DtgSelected.SelectedItem as Bike); if (dialog.ShowDialog() == true) { dc.UpdateEntity(dialog.bike); MessageBox.Show("Item updated successfully"); DtgSelected.ItemsSource = GenerateBikeList(); } } if (RentersSelected) { //Launch edit renters window } }