public ActionResult DeleteConfirmed(int id) { Course course = courseService.Get(id); try { prerequisiteService.DeleteAllByCourse(course.Id); courseService.Delete(course); return(RedirectToAction("Index")); } catch (Exception ex) { return(View(course)); } }