public ActionResult Delete(int id) { tb_categorias regCat = data.tb_categorias.Where(c => c.idcate == id).First(); data.tb_categorias.Remove(regCat); data.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(tb_categorias objCat) { if (!ModelState.IsValid) { return(View(new tb_categorias())); } data.tb_categorias.Add(objCat); data.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Desactivar(int id) { tb_categorias regCat = data.tb_categorias.Where(c => c.idcate == id).First(); if (regCat.estado == "A") { regCat.estado = "I"; } else { regCat.estado = "A"; } data.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(tb_categorias objCat) { if (!ModelState.IsValid) { return(View(objCat)); } tb_categorias regCat = data.tb_categorias.Where(c => c.idcate == objCat.idcate).First(); regCat.nomcate = objCat.nomcate; regCat.descripcion = objCat.descripcion; regCat.estado = objCat.estado; data.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Details(int id) { tb_categorias regCat = data.tb_categorias.Where(c => c.idcate == id).First(); return(View(regCat)); }