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()); } }