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");
            }
        }
        /// <summary>
        /// Refresh the stats.
        /// </summary>
        /// <returns></returns>
        public ActionResult RefreshStats()
        {
            CourseListingDataAccess dataAccess = new CourseListingDataAccess(RavenSession);
            dataAccess.PopulateHistoricalData();

            return RedirectToAction("Assignment5", "Assignments");
        }
        /// <summary>
        /// Reloads the data.
        /// </summary>
        /// <param name="semesterID">The semester ID.</param>
        /// <returns></returns>
        public ActionResult LoadData(string semesterID)
        {
            CourseListingDataAccess dataAccess = new CourseListingDataAccess(RavenSession);

            if(!string.IsNullOrEmpty(semesterID))
            {
                HttpContext.Server.ScriptTimeout = 600000;
                dataAccess.LoadSemesterToDatabase(semesterID);
            }
            else
            {
                HttpContext.Server.ScriptTimeout = 6000000;
                dataAccess.LoadAllCourseDataToDatabase();
            }

            return RedirectToAction("Assignment5", "Assignments");
        }
        /// <summary>
        /// Deletes the data.
        /// </summary>
        /// <returns></returns>
        public ActionResult DeleteData()
        {
            CourseListingDataAccess dataAccess = new CourseListingDataAccess(RavenSession);

            dataAccess.DeleteAllCourseData();

            return RedirectToAction("Assignment5", "Assignments");
        }
        public ActionResult Assignment5(CourseListingViewModel viewModel)
        {
            CourseListingDataAccess dataAccess = new CourseListingDataAccess(RavenSession);

            //Populate the dropdowns
            viewModel.Semesters = dataAccess.GetAllSemesters();
            viewModel.Departments = dataAccess.GetAllDepartmentsForCurrentSemester();

            if(!string.IsNullOrEmpty(viewModel.Semester) && !string.IsNullOrEmpty(viewModel.Department))
            {
                viewModel.Courses = dataAccess.GetCoursesBySemesterIDandDepartmentID(viewModel.Semester, viewModel.Department);
            }

            return View("Assignment5", viewModel);
        }
        /// <summary>
        /// Assignment5s this instance.
        /// </summary>
        /// <returns></returns>
        public ActionResult Assignment5()
        {
            CourseListingDataAccess dataAccess = new CourseListingDataAccess(RavenSession);
            CourseListingViewModel viewModel = new CourseListingViewModel();

            //Populate the dropdowns
            viewModel.Semesters = dataAccess.GetAllSemesters();
            viewModel.Departments = dataAccess.GetAllDepartmentsForCurrentSemester(); //TODO: AJAX populate based off semester

            return View("Assignment5", viewModel);
        }
        /// <summary>
        /// Assignment4s the specified refresh data.
        /// </summary>
        /// <param name="refreshData">The refresh data.</param>
        /// <param name="reloadData">The reload data.</param>
        /// <param name="recalculateStats">The recalculate stats.</param>
        /// <returns></returns>
        public ActionResult Assignment4(string reloadData, string recalculateStats, string deleteData)
        {
            CourseListingDataAccess dataAccess = new CourseListingDataAccess(RavenSession);
            Assignment4ViewModel model = new Assignment4ViewModel();

            if(!string.IsNullOrEmpty(reloadData) && reloadData.Trim() == "1")
            {
                dataAccess.LoadAllCourseDataToDatabase();
            }

            if(!string.IsNullOrEmpty(deleteData) && deleteData.Trim() == "1")
            {
                dataAccess.DeleteAllCourseData();
            }

            if(!string.IsNullOrEmpty(recalculateStats) && recalculateStats.Trim() == "1")
            {
                dataAccess.PopulateHistoricalData();
            }

            model.Courses = dataAccess.GetCoursesBySemesterIDandDepartmentID("Fall2013", "IT");

            return View("Assignment4", model);
        }