Пример #1
0
 public ActionResult GetChartData(int? idCentro = null)
 {
     var db = new edayRoomEntities();
     var interval = idCentro==null?15:1;
     var user = db.users.Single(u => u.username == User.Identity.Name);
     var data = db.GetMovilizacion(idCentro, interval, user.id).ToList();
     //var participaciones = db.Participacions.GroupBy(p => p.fecha).Select(p => new { fecha = p.Key, conteo = p.Sum(c => c.conteo), cola = p.Sum(c => c.cola) });
     return Json(new
                     {
                         movilizacion =
                     data.Select(
                         p =>
                         new
                             {
                                 value = p.value,
                                 year = ((DateTime)p.fecha).Year,
                                 month = ((DateTime)p.fecha).Month - 1,
                                 day = ((DateTime)p.fecha).Day,
                                 hour = ((DateTime)p.fecha).Hour,
                                 min = ((DateTime)p.fecha).Minute
                             }),
                     }, JsonRequestBehavior.AllowGet);
 }