public ActionResult RealDeleteConfirmed(short id) { OpcionesDelPlano opcionesDelPlano = db.OPCIONPLANO.Find(id); db.OPCIONPLANO.Remove(opcionesDelPlano); db.SaveChanges(); TempData["Type"] = "error"; TempData["Message"] = "El registro se eliminó correctamente"; return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Descripcion,Estado,FechaDeInicio,FechaDeFin")] OpcionesDelPlano opcionesDelPlano) { if (ModelState.IsValid) { db.Entry(opcionesDelPlano).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(opcionesDelPlano)); }
// GET: OpcionesDelPlanoes/Edit/5 public ActionResult Edit(short?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } OpcionesDelPlano opcionesDelPlano = db.OPCIONPLANO.Find(id); if (opcionesDelPlano == null) { return(HttpNotFound()); } return(View(opcionesDelPlano)); }
public ActionResult DeleteConfirmed(short id) { OpcionesDelPlano opcionesDelPlano = db.OPCIONPLANO.Find(id); if (opcionesDelPlano.Estado == "I") { opcionesDelPlano.Estado = "A"; } else { opcionesDelPlano.Estado = "I"; } db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "Id,Descripcion,Estado,FechaDeInicio,FechaDeFin")] OpcionesDelPlano opcionesDelPlano) { if (ModelState.IsValid) { db.OPCIONPLANO.Add(opcionesDelPlano); string mensaje = Verificar(opcionesDelPlano.Id); if (mensaje == "") { db.SaveChanges(); TempData["Type"] = "success"; TempData["Message"] = "El registro se realizó correctamente"; return(RedirectToAction("Index")); } else { ViewBag.Type = "warning"; ViewBag.Message = mensaje; return(View(opcionesDelPlano)); } } return(View(opcionesDelPlano)); }