Exemple #1
0
 public IHttpActionResult PutRegisterUserInPlan(JsonRegistryPlan pJsonPlan)
 {
     try
     {
         JObject joResponse = new JObject();
         if (pJsonPlan == null)
         {
             return(BadRequest());
         }
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         if (Funcion.SLMFUserExists(pJsonPlan.userId) == false)
         {
             return(NotFound());
         }
         if (Funcion.PlanExists(pJsonPlan.idPlan) == false)
         {
             return(NotFound());
         }
         else
         {
             int iPlanID = Funcion.GetPlanId(pJsonPlan.idPlan);
             int iUserID = Funcion.GetUserId(pJsonPlan.userId);
             joResponse = UpdateUserPlan(iUserID, iPlanID, pJsonPlan.day);
         }
         return(Ok(joResponse));
     }
     catch
     {
         return(InternalServerError());
     }
 }
Exemple #2
0
 public ActionResult Plan(string disciplinaTitle, string planName)
 {
     if (Funcion.DisciplinaExists(disciplinaTitle) == false)
     {
         return(HttpNotFound());
     }
     if (Funcion.PlanExists(planName) == false)
     {
         return(HttpNotFound());
     }
     else
     {
         int    iPlanID = Funcion.GetPlanId(planName);
         Plan   bdPlan  = db.Plan.Find(iPlanID);
         string sRoot   = Convert.ToString(Session["AppURL"]);
         Session["Disciplina"]              = bdPlan.Disciplina.Nombre.Replace(" ", "-").ToLower();
         Session["SeccionActiva"]           = "";
         Session["ThisSecctionIsDashboard"] = "true";
         Session["CurrentPlan"]             = bdPlan.Nombre.Replace(" ", "-").Replace("&", "and").ToLower();
         Session["CurrentDiscipline"]       = bdPlan.Disciplina.Nombre.Replace(" ", "-").ToLower();
         string vLoaderImages = "";
         ViewBag.Loader = vLoaderImages;
         return(View(bdPlan));
     }
 }
Exemple #3
0
 public IHttpActionResult GetPlan(JsonGetPlan pJsonPlan)
 {
     try
     {
         JObject joResponse = new JObject();
         if (pJsonPlan == null)
         {
             return(BadRequest());
         }
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         if (Funcion.PlanExists(pJsonPlan.planid) == false)
         {
             return(NotFound());
         }
         else
         {
             int iPlanID = Funcion.GetPlanId(pJsonPlan.planid);
             joResponse = CreateJsonPlan(iPlanID);
         }
         return(Ok(joResponse));
     }
     catch
     {
         return(InternalServerError());
     }
 }