CTCClassSchedule.Controllers.ClassesController.ClassDetails C# (CSharp) Метод

ClassDetails() приватный Метод

private ClassDetails ( string Prefix, string ClassNum, string format ) : System.Web.Mvc.ActionResult
Prefix string
ClassNum string
format string
Результат System.Web.Mvc.ActionResult
        public ActionResult ClassDetails(string Prefix, string ClassNum, string format)
        {
            ICourseID courseID = CourseID.FromString(Prefix, ClassNum);
              ClassDetailsModel model;

            using (OdsRepository repository = new OdsRepository(HttpContext))
            {
                IList<Course> courses;
                using (_profiler.Step("ODSAPI::GetCourses()"))
                {
                    courses = repository.GetCourses(courseID);
                }

            IList<YearQuarter> navigationQuarters = Helpers.GetYearQuarterListForMenus(repository);
            IList<YearQuarter> quartersOffered = new List<YearQuarter>();
            string learningOutcomes = string.Empty;
                if (courses.Count > 0)
                {
                    using (_profiler.Step("Getting Course counts (per YRQ)"))
                    {
                        // Identify which, if any, of the current range of quarters has Sections for this Course
                        foreach (YearQuarter quarter in navigationQuarters)
                        {
                            // TODO: for better performance, overload method to accept more than one YRQ
                            if (repository.SectionCountForCourse(courseID, quarter) > 0)
                            {
                                quartersOffered.Add(quarter);
                            }
                        }
                    }

              // Get the course learning outcomes
              using (_profiler.Step("Retrieving course outcomes"))
                    {
            learningOutcomes = Helpers.GetCourseOutcome(courseID);
                    }
                }

            // Create the model
            model = new ClassDetailsModel
            {
              Courses = courses,
              CurrentQuarter = repository.CurrentYearQuarter,
              NavigationQuarters = navigationQuarters,
              QuartersOffered = quartersOffered,
              CMSFootnote = GetCmsFootnote(courseID),
              LearningOutcomes = learningOutcomes,
            };

            Subject subject = SubjectInfo.GetSubjectFromPrefix(Prefix);
            if (subject != null)
            {
              SubjectInfoResult programInfo = SubjectInfo.GetSubjectInfo(subject.Slug);
              model.Slug = programInfo.Subject.Slug;
              model.SubjectTitle = programInfo.Subject.Title;
              model.SubjectIntro = programInfo.Subject.Intro;
              model.DepartmentTitle = programInfo.Department.Title;
              model.DepartmentURL = programInfo.Department.URL;
              model.DivisionTitle = programInfo.Division.Title;
              model.DivisionURL = programInfo.Division.URL;
            }
            }

              if (format == "json")
              {
            // NOTE: AllowGet exposes the potential for JSON Hijacking (see http://haacked.com/archive/2009/06/25/json-hijacking.aspx)
            // but is not an issue here because we are receiving and returning public (e.g. non-sensitive) data
            return Json(model, JsonRequestBehavior.AllowGet);
              }
              return View(model);
        }