public IActionResult RemoveCourseFromSchedule(int courseId) { List <Course> scheduledCourses = HttpContext.Session.Get <List <Course> >("scheduledCourses"); if (scheduledCourses == null) { scheduledCourses = new List <Course>(); } List <Course> allCourses = MockCRMSData.PopulateCourses(); Course course = allCourses.Find(delegate(Course c) { return(c.ID == courseId); }); if (scheduledCourses.Any(c => c.ID == courseId)) { scheduledCourses.RemoveAll(i => i.ID == courseId); } HttpContext.Session.Set <List <Course> >("scheduledCourses", scheduledCourses); return(Content("Removed")); }
public IActionResult CourseResults(List <string> selectedSubjects, List <string> selectedCampuses, string selectedInstructors, List <string> selectedCourseLevels, List <string> selectedInstructionalMethods, List <string> selectedScheduleTypes, string CourseTitle, string CourseNumber, string creditHourRangeStart, string creditHourRangeEnd, string Monday, string Tuesday, string Wednesday, string Thursday, string Friday, string Saturday, string Sunday, string startTimeTimepicker, string endTimeTimepicker) { List <Course> allCourses = MockCRMSData.PopulateCourses(); List <Course> coursesToReturn = allCourses; if (!(selectedSubjects.Count() == 0 || (selectedSubjects.Count() == 1 && selectedSubjects.First().Equals("All")))) { coursesToReturn = findCoursesBySubjects(allCourses, selectedSubjects); } if (!(selectedCampuses.Count() == 0 || (selectedCampuses.Count() == 1 && selectedCampuses.First().Equals("All")))) { coursesToReturn = findCoursesByCampuses(coursesToReturn, selectedCampuses); } if (!(selectedInstructionalMethods.Count() == 0 || (selectedInstructionalMethods.Count() == 1 && selectedInstructionalMethods.First().Equals("All")))) { coursesToReturn = findCoursesByInstructionalMethods(coursesToReturn, selectedInstructionalMethods); } if (!(selectedCourseLevels.Count() == 0 || (selectedCourseLevels.Count() == 1 && selectedCourseLevels.First().Equals("All")))) { coursesToReturn = findCoursesByCourseLevels(coursesToReturn, selectedCourseLevels); } if (!(selectedInstructors == null || selectedInstructors.Equals(""))) { coursesToReturn = findCoursesByInstructors(coursesToReturn, selectedInstructors); } if (!(selectedScheduleTypes.Count() == 0 || (selectedScheduleTypes.Count() == 1 && selectedScheduleTypes.First().Equals("All")))) { coursesToReturn = findCoursesByScheduleTypes(coursesToReturn, selectedScheduleTypes); } if (!(CourseTitle == null || CourseTitle.Equals(""))) { coursesToReturn = findCoursesByCourseTitle(coursesToReturn, CourseTitle); } if (!(CourseNumber == null || CourseNumber.Equals(""))) { coursesToReturn = findCoursesByCourseNumber(coursesToReturn, CourseNumber); } if (Monday != null || Tuesday != null || Wednesday != null || Thursday != null || Friday != null || Saturday != null || Sunday != null) { coursesToReturn = findCoursesByClassDays(coursesToReturn, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday); } if (!(startTimeTimepicker == null || startTimeTimepicker.Equals("")) && !(endTimeTimepicker == null || endTimeTimepicker.Equals(""))) { coursesToReturn = findCoursesByClassTimes(coursesToReturn, startTimeTimepicker, endTimeTimepicker); } coursesToReturn = findCoursesByCreditHourRange(coursesToReturn, creditHourRangeStart, creditHourRangeEnd); ViewBag.Courses = coursesToReturn; return(View()); }