public ActionResult DeleteConfirmed(int id) { subcategoria subcategoria = db.subcategoria.Find(id); db.subcategoria.Remove(subcategoria); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "subcategoriaId,categoriaId,subcategoriaNombre")] subcategoria subcategoria) { if (ModelState.IsValid) { db.Entry(subcategoria).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.categoriaId = new SelectList(db.categoria, "categoriaId", "categoriaNombre", subcategoria.categoriaId); return(View(subcategoria)); }
public ActionResult Create([Bind(Include = "subcategoriaId,categoriaId,subcategoriaNombre")] subcategoria subcategoria) { if (ModelState.IsValid) { db.subcategoria.Add(subcategoria); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.categoriaId = new SelectList(db.categoria, "categoriaId", "categoriaNombre", subcategoria.categoriaId); return(View(subcategoria)); }
// GET: subcategorias/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } subcategoria subcategoria = db.subcategoria.Find(id); if (subcategoria == null) { return(HttpNotFound()); } return(View(subcategoria)); }
// GET: subcategorias/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } subcategoria subcategoria = db.subcategoria.Find(id); if (subcategoria == null) { return(HttpNotFound()); } ViewBag.categoriaId = new SelectList(db.categoria, "categoriaId", "categoriaNombre", subcategoria.categoriaId); return(View(subcategoria)); }