示例#1
0
        public JsonResult GetStudentByCourse(string CourseID)
        {
            List <ChartModel> lst = new List <ChartModel>();
            Guid id = Guid.Parse(CourseID);
            List <GetStudentUniversity_Result> DBlst = db.GetStudentUniversity(id).ToList();

            if (DBlst != null && DBlst.Count > 0)
            {
                foreach (var item in DBlst)
                {
                    lst.Add(new ChartModel {
                        NoOfStudent = item.NoOfStudent + 1000, Category = item.UniversityName
                    });
                }
            }

            //lst.Add(new ChartModel { NoOfStudent = 100, Category = "Baker University" });
            //lst.Add(new ChartModel { NoOfStudent = 589, Category = "Barstow College" });
            //lst.Add(new ChartModel { NoOfStudent = 258, Category = "Benedictine University" });
            //lst.Add(new ChartModel { NoOfStudent = 987, Category = "Northeastern University " });
            //lst.Add(new ChartModel { NoOfStudent = 547, Category = "University of Virginia" });
            //lst.Add(new ChartModel { NoOfStudent = 25, Category = "Upper Iowa University " });

            return(Json(lst, JsonRequestBehavior.AllowGet));
        }