private void ButtonAdd_Click(object sender, RoutedEventArgs e) { CollegeSubjectDialog collegeSubjectDialog = new CollegeSubjectDialog() { Title = "Adicionar Curso" }; if (collegeSubjectDialog.ShowDialog() == true) { subjects.Add(DbContextHelper.AddCollegeSubject(_db, collegeSubjectDialog.CollegeSubject)); subjectGrd.SelectedIndex = subjectGrd.Items.Count - 1; } }
private void ButtonEdit_Click(object sender, RoutedEventArgs e) { CollegeSubject employeeEdit = subjectGrd.SelectedItem as CollegeSubject; if (employeeEdit == null) { return; } CollegeSubjectDialog collegeSubjectDialog = new CollegeSubjectDialog(new CollegeSubject(employeeEdit)) { Title = "Editar Curso" }; if (collegeSubjectDialog.ShowDialog() == true) { DbContextHelper.EditSubject(_db, collegeSubjectDialog.CollegeSubject); subjectGrd.Items.Refresh(); } }