public List <Lecture> GetContacts(DateTime afterDate) { var lectures = lectureService.GetAllLecture().Where(a => a.AddedOn > afterDate).OrderByDescending(a => a.AddedOn).ToList(); var course = courseService.GetCourse(lectures.FirstOrDefault().CourseId); foreach (var lecture in lectures) { lecture.Course = course; } return(lectures); }
public ActionResult DeleteLecture(int id = 0) { var user = Session["User"] as User; if (user == null) { return(RedirectToAction("Login", "UserRegistration")); } else { if (id != 0) { var lecture = lectureService.GetLecture(id); if (lecture != null) { lectureService.DeleteLecture(lecture); } id = 0; } var lectures = lectureService.GetAllLecture(); return(View(lectures)); } }