public ActionResult ApiJson(string semesterID, string departmentID, string courseID) { if(!string.IsNullOrEmpty(semesterID) && !string.IsNullOrEmpty(departmentID)) { List<Course> courses = new List<Course>(); CourseListingDataAccess dataAccess = new CourseListingDataAccess(RavenSession); if (string.IsNullOrEmpty(courseID)) { courses = dataAccess.GetCoursesBySemesterIDandDepartmentID(semesterID, departmentID); } else { courses = dataAccess.GetCourses(semesterID, departmentID, courseID); } MvcJsonResult jsonNetResult = new MvcJsonResult(); jsonNetResult.Formatting = Formatting.Indented; jsonNetResult.Data = courses; return jsonNetResult; } else { return RedirectToAction("ApiHelp", "Assignments"); } }
public ActionResult ApiXml(string semesterID, string departmentID, string courseID) { if(!string.IsNullOrEmpty(semesterID) && !string.IsNullOrEmpty(departmentID)) { List<Course> courses = new List<Course>(); CourseListingDataAccess dataAccess = new CourseListingDataAccess(RavenSession); if(string.IsNullOrEmpty(courseID)) { courses = dataAccess.GetCoursesBySemesterIDandDepartmentID(semesterID, departmentID); } else { courses = dataAccess.GetCourses(semesterID, departmentID, courseID); } return new MvcXmlResult(courses); } else { return RedirectToAction("ApiHelp", "Assignments"); } }