private async void DeleteCourseBtn_Click(object sender, RoutedEventArgs e) { IParentWindow parent = ParentFinder.FindParent <AdminPanelWindow>(this); MessageDialogResult r = await parent.ShowMessage("Warning", "Are you sure you want to delete this course", MessageDialogStyle.AffirmativeAndNegative); if (r == MessageDialogResult.Negative) { return; } Button btn = (Button)sender; CourseModel model = new CourseModel(); model = (CourseModel)btn.Tag; // TODO - Delete the selected department if (GlobalConfig.Connection.DeleteCourse_ById(model.Id)) { Courses.Remove(model); WireUpLists(); // TODO - Delete the selected term } else { await parent.ShowMessage("Deletion Error", "The selected course can't be deleted beacause it has an exam", MessageDialogStyle.Affirmative); // TODO - ADD a MessageBox } }
private async void DeleteAssignmentBtn_Click(object sender, RoutedEventArgs e) { IParentWindow parent = ParentFinder.FindParent <AdminPanelWindow>(this); MessageDialogResult r = await parent.ShowMessage("Warning", "Are you sure you want to delete this assginment", MessageDialogStyle.AffirmativeAndNegative); if (r == MessageDialogResult.Negative) { return; } // // TODO - Delete the selected Assignment AssignmentModel model = (AssignmentModel)assignmentsGrid.SelectedItem; if (GlobalConfig.Connection.DeleteAssignment_ById(model.Id)) { Assignments.Remove(model); WireUpLists(Assignments); // TODO - Delete the selected term } else { await parent.ShowMessage("Deletion Error", "The selected assignment can't be deleted beacause it has an exam", MessageDialogStyle.Affirmative); // TODO - ADD a MessageBox } }