Esempio n. 1
0
        public JsonResult GetStudentByPeriods()
        {
            var result = _periodRepository.GetSummary();

            string[] labels      = new string[result.Data.Count()]; //{ "Pre-Kinder", "Kinder", "Primero", "Segundo", "Tercero", "Cuarto", "Quinto", "Sexto", "Septimo", "Octavo", "Noveno" };
            int[]    information = new int[result.Data.Count()];    //= { 65, 59, 80, 81, 56, 55, 40, 8, 15, 25, 62 };

            for (int i = 0; i < result.Data.Count(); i++)
            {
                labels[i]      = result.Data[i].Description;
                information[i] = result.Data[i].Count;
            }
            var jsonData = new
            {
                labelInfo  = labels,
                dataInfo   = information,
                labelTitle = "Students Count by periods"
            };

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