Ejemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            AgriProduct agriProduct = db.AgriProducts.Find(id);

            db.AgriProducts.Remove(agriProduct);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "Product_ID,Product_Name")] AgriProduct agriProduct)
 {
     if (ModelState.IsValid)
     {
         db.Entry(agriProduct).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(agriProduct));
 }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "Product_ID,Product_Name")] AgriProduct agriProduct)
        {
            if (ModelState.IsValid)
            {
                db.AgriProducts.Add(agriProduct);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(agriProduct));
        }
Ejemplo n.º 4
0
        // GET: AgriProducts/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AgriProduct agriProduct = db.AgriProducts.Find(id);

            if (agriProduct == null)
            {
                return(HttpNotFound());
            }
            return(View(agriProduct));
        }