public ActionResult DeleteConfirmed(int id) { PermanentDiscount permanentDiscount = db.PermanentDiscounts.Find(id); db.PermanentDiscounts.Remove(permanentDiscount); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "idPermanentDiscount,discount,treshold")] PermanentDiscount permanentDiscount) { if (ModelState.IsValid) { db.Entry(permanentDiscount).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(permanentDiscount)); }
public ActionResult Create([Bind(Include = "idPermanentDiscount,discount,treshold")] PermanentDiscount permanentDiscount) { if (ModelState.IsValid) { db.PermanentDiscounts.Add(permanentDiscount); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(permanentDiscount)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PermanentDiscount permanentDiscount = db.PermanentDiscounts.Find(id); if (permanentDiscount == null) { return(HttpNotFound()); } return(View(permanentDiscount)); }