예제 #1
0
        public JsonResult GetGradeExpenseByActivePeriod()
        {
            var result = _gradeRepository.GetExpenseSummary(Int32.Parse(_periodId));

            string[]  labels      = new string[result.Data.Count()];  //{ "Pre-Kinder", "Kinder", "Primero", "Segundo", "Tercero", "Cuarto", "Quinto", "Sexto", "Septimo", "Octavo", "Noveno" };
            decimal[] information = new decimal[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].Amount;
            }
            var jsonData = new
            {
                labelInfo  = labels,
                dataInfo   = information,
                labelTitle = "Grades Expenses by period " + _period
            };

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