private void ButtonEdit_Click(object sender, RoutedEventArgs e) { int selectedIndex = dataGridAddAnimals.SelectedIndex; if (selectedIndex < 0) { MessageBox.Show("Не выбрано животное для редактирования"); return; } var ap = new DBManager().getSupplierList(); Models.ModelSupplier modelSupplier = null; foreach (var it in ap) { if (it.Id_Supplier == listSupplier[selectedIndex].Id_Supplier) { modelSupplier = it; break; } } var ce = new AddAnimalEditWindow(modelSupplier); ce.ShowDialog(); }
private void ButtonAdd_Click(object sender, RoutedEventArgs e) { var ce = new AddAnimalEditWindow(null); ce.ShowDialog(); }