// GET: PlanDias/Create public ActionResult Create(int?plan, int?pagina) { if (plan == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Plan bdPlan = db.Plan.Find(plan); if (bdPlan == null) { return(HttpNotFound()); } ViewBag.Pagina = (pagina ?? 1); int iNextDay = Funcion.GetLastPlanDay(plan) + 1; PlanDias bdPlanDias = new PlanDias(); bdPlanDias.PlanID = Convert.ToInt32(plan); bdPlanDias.Dia = iNextDay; ViewBag.DietaID = new SelectList(Funcion.GetListaDietas(), "Value", "Text"); ViewBag.ProTipID = new SelectList(Funcion.GetListaProTips(), "Value", "Text"); ViewBag.RutinaID = new SelectList(db.Rutina.OrderBy(s => s.Nombre), "ID", "Nombre"); return(View(bdPlanDias)); }