public ActionResult Erase(int id) { Embal embal = db.Embals.Find(id); db.Embals.Remove(embal); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Sigla,InsumoId")] Embal embal) { if (ModelState.IsValid) { db.Entry(embal).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.InsumoId = new SelectList(db.Insumos, "InsumoId", "Apelido", embal.InsumoId); return(View(embal)); }
public ActionResult Create([Bind(Include = "Id,Sigla,InsumoId")] Embal embal) { if (ModelState.IsValid) { db.Embals.Add(embal); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.InsumoId = new SelectList(db.Insumos, "InsumoId", "Apelido", embal.InsumoId); return(View(embal)); }
// GET: Embals/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Embal embal = db.Embals.Find(id); if (embal == null) { return(HttpNotFound()); } ViewBag.InsumoId = new SelectList(db.Insumos, "InsumoId", "Apelido", embal.InsumoId); return(View(embal)); }
// GET: Embals/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Embal embal = db.Embals .Include(e => e.Insumo) .SingleOrDefault(e => e.Id == id); if (embal == null) { return(HttpNotFound()); } return(View(embal)); }
public ActionResult DeleteConfirmed(int id) { Embal embal = db.Embals.Find(id); return(View("Erase", embal)); }