private void DeleteButton_Click(Object sender, RoutedEventArgs e) { Operator op = (Operator)addOperatorDataGrid.SelectedItem; if (op != null) { OperatorService operatorService = new OperatorService(); if (MessageBox.Show("Do you want to DELETE?", "Confirm", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { operatorService.DeleteOperator(op.Id); LoadData(); } } }