public ActionResult DeleteConfirmed(int id) { SparProducts sparProducts = db.SparProducts.Find(id); db.SparProducts.Remove(sparProducts); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "productID,productName,productImage,productPrice,productDropPercent,productDescription,productDateEndPromo")] SparProducts sparProducts) { if (ModelState.IsValid) { db.Entry(sparProducts).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sparProducts)); }
public ActionResult Create([Bind(Include = "productID,productName,productImage,productPrice,productDropPercent,productDescription,productDateEndPromo")] SparProducts sparProducts) { if (ModelState.IsValid) { db.SparProducts.Add(sparProducts); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(sparProducts)); }
// GET: SparProducts/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SparProducts sparProducts = db.SparProducts.Find(id); if (sparProducts == null) { return(HttpNotFound()); } return(View(sparProducts)); }