Beispiel #1
0
        public ActionResult Erase(int id)
        {
            Embal embal = db.Embals.Find(id);

            db.Embals.Remove(embal);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 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));
 }
Beispiel #3
0
        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));
        }
Beispiel #4
0
        // 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));
        }
Beispiel #5
0
        // 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));
        }
Beispiel #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            Embal embal = db.Embals.Find(id);

            return(View("Erase", embal));
        }