//the update method is called when the button edit course is clicked //this method will cause a window apears where a existing course can be edited private void CreateCourse_Click(object sender, RoutedEventArgs e) { var dlg = new CourseEditor(databaseController); dlg.ShowDialog(); dlg.Close(); CoursesGrid.ItemsSource = databaseController.RetrieveAllDbCourses(); }
// Open course editor with selected course private void Update_Click(object sender, EventArgs e) { if (CoursesGrid.SelectedIndex.Equals(-1)) { return; } var dlg = new CourseEditor((Course)CoursesGrid.SelectedItem, databaseController); dlg.ShowDialog(); dlg.Close(); CoursesGrid.ItemsSource = databaseController.RetrieveAllDbCourses(); }