Exemple #1
0
        private JObject CreateJsonPlan(int pPlanId)
        {
            JObject joResponse = new JObject();
            var     bdPlanes   = from data in db.Plan.Where(s => s.ID == pPlanId).Include(p => p.PlanEtiquetas).Include(p => p.PlanDias).Include(p => p.Disciplina)
                                 select data;
            var bdPlan = bdPlanes.Include(p => p.PlanEtiquetas).Include(p => p.PlanDias).Include(p => p.Disciplina).First();

            joResponse =
                new JObject(
                    new JProperty("home",
                                  new JObject(
                                      new JProperty("bgURL", sFolderImagesPlans.Replace("~/", sSiteURL) + bdPlan.FileImage),
                                      new JProperty("title",
                                                    new JArray(
                                                        new JValue(Funcion.DivideTitulo(bdPlan.Nombre.ToUpper(), 1)),
                                                        new JValue(Funcion.DivideTitulo(bdPlan.Nombre.ToUpper(), 2))
                                                        )
                                                    ),
                                      new JProperty("subtitle", bdPlan.Leyenda),
                                      new JProperty("description", bdPlan.Descripcion),
                                      new JProperty("level", GetLevel(bdPlan.PlanEtiquetas)),
                                      new JProperty("levelPercent", GetLevelPercent(bdPlan.PlanEtiquetas)),
                                      new JProperty("weeks", GetWeeksPlan(bdPlan.PlanDias)),
                                      new JProperty("weeksPercent", GetWeeksPlanPercent(bdPlan.PlanDias)),
                                      new JProperty("genderIcon", GetIconGender(bdPlan.PlanEtiquetas))
                                      )
                                  ),
                    new JProperty("muscleGroups", GetJsonMuscleGroups()),
                    new JProperty("days", GetJsonDaysPlan(bdPlan.PlanDias)),
                    new JProperty("banners", GetJsonBanners())
                    );
            return(joResponse);
        }