public void Delete(int courseID) { using (var db = new AcademyContext()) { var courseDeleteQuery = db.Courses.Include(course => course.Bookings); SelectedCourse = db.Courses.Find(courseID); db.Remove(SelectedCourse); db.SaveChanges(); } }