// // GET: /ScheduledCourse/List/ public ActionResult List() { List <PLMajor> list = MajorClientService.GetMajorList(); ViewBag.breadCrumbData = "Major List"; return(View("List", list)); }
public ActionResult GetMajorList() { List <PLMajor> majorList = MajorClientService.GetMajorList(); JavaScriptSerializer jsonSerialiser = new JavaScriptSerializer(); string majorListJson = jsonSerialiser.Serialize(majorList); // return the JSON string return(Content(majorListJson)); }
/* * * public ActionResult Filter(string yearFilter, string quarterFilter) * { * if (yearFilter == null) * yearFilter = ""; * * if (quarterFilter == null) * quarterFilter = ""; * * string student_id = Session["id"].ToString(); * * PLStudent student = StudentClientService.GetStudentDetail(student_id); * ViewBag.student = student; * * List<PLScheduledCourse> scheduleList = ScheduleClientService.GetScheduleList(Convert.ToInt32(yearFilter), quarterFilter); * * return Json(scheduleList); * }*/ // // AJAX: for /Major/Create public JsonResult GetSampleMajor(int idx) { List <string> errors = new List <string>(); List <PLMajor> list = MajorClientService.GetMajorList(); /*System.Diagnostics.Debug.WriteLine("List Count:" + list.Count); * System.Diagnostics.Debug.WriteLine("MajorID:" + list[idx].major_id); * System.Diagnostics.Debug.WriteLine("MajorName:" + list[idx].major_name); * System.Diagnostics.Debug.WriteLine("DeptID:" + list[idx].dept_id);*/ for (int i = 0; i < list.Count; i++) { if (list[i].major_id == idx) { return(this.Json(list[i], JsonRequestBehavior.AllowGet)); } } errors.Add("major id not found"); return(this.Json(errors)); }