private void ButtonAddStudent_Click(object sender, RoutedEventArgs e) { var studentWindow = new AddEditStudentWindow(null, _calculator); if (studentWindow.ShowDialog() == true) { _repo.Students.Add(studentWindow.Student); UpdateStudentList(); } }
private void ButtonEditStudent_Click_1(object sender, RoutedEventArgs e) { var selectedStudent = listBoxStudents.SelectedItem as Student; if (selectedStudent == null) { MessageBox.Show("Select a course from the list"); return; } var studentWindow = new AddEditStudentWindow(selectedStudent, _calculator); if (studentWindow.ShowDialog() == true) { UpdateStudentList(); } }