public ActionResult CrearPlan() { ViewBag.Modalidades = ObtenerTodosModalidades(); ViewBag.Sedes = ObtenerTodosSedes(); var model = new StudyPlan(); return View(); }
public ActionResult CrearPlan(StudyPlan plan, int Modalidades, List<int> Sedes) { String entidad = Request.Cookies["Entidad"].Value; int entidadID; if (entidad.Equals("TEC")) { entidadID = 1; } else if (entidad.Equals("CIE")) { entidadID = 7; } else if (entidad.Equals("TAE")) { entidadID = 5; } else if (entidad.Equals("MAE")) { entidadID = 6; } else if (entidad.Equals("DDE")) { entidadID = 11; } else if (entidad.Equals("Emprendedores")) { entidadID = 12; } else if (entidad.Equals("Actualizacion_Cartago")) { entidadID = 9; } else { entidadID = 8; } if (plan.Name == null) { TempData[TempDataMessageKey] = "Ingrese un Nombre"; return RedirectToAction("CrearPlan"); } if (existe(plan.Name, Modalidades) != null) { TempData[TempDataMessageKey] = "Ya existe ese plan de estudio"; return RedirectToAction("CrearPlan"); } if (Sedes == null) { TempData[TempDataMessageKey] = "Seleccione al menos una sede"; return RedirectToAction("CrearPlan"); } plan.ModeID = Modalidades; plan.EntityTypeID = entidadID; agregarPlan(plan); int idplan = IdPlanDeEstudioPorIdModalidad(plan.Name, Modalidades); StudyPlanXSede planXSede = new StudyPlanXSede(); planXSede.StudyPlanID = idplan; foreach (int idsede in Sedes) { planXSede.SedeID = idsede; agregrarPlanXSede(planXSede); } TempData[TempDataMessageKeySuccess] = "Plan Creado Exitosamente"; return RedirectToAction("CrearBloqueXPlan", "BloqueXPlan", new { plan = idplan }); }
public void agregarPlan(StudyPlan Plan) { gvDatabase.StudyPlans.Add(Plan); Save(); }
public ActionResult EliminarPlan(StudyPlan plan, string button) { TempData[TempDataMessageKey] = EliminarPlan(plan.ID); return RedirectToAction("Index"); }