public ActionResult DeleteConfirmed(int id) { DiscountCodeForItem discountCodeForItem = db.DiscountCodeForItems.Find(id); db.DiscountCodeForItems.Remove(discountCodeForItem); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Item_idItem,DiscountCode_idDiscountCode,discount")] DiscountCodeForItem discountCodeForItem) { if (ModelState.IsValid) { db.Entry(discountCodeForItem).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DiscountCode_idDiscountCode = new SelectList(db.DiscountCodes, "idDiscountCode", "code", discountCodeForItem.DiscountCode_idDiscountCode); ViewBag.Item_idItem = new SelectList(db.Items, "idItem", "name", discountCodeForItem.Item_idItem); return(View(discountCodeForItem)); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DiscountCodeForItem discountCodeForItem = db.DiscountCodeForItems.Find(id); if (discountCodeForItem == null) { return(HttpNotFound()); } return(View(discountCodeForItem)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DiscountCodeForItem discountCodeForItem = db.DiscountCodeForItems.Find(id); if (discountCodeForItem == null) { return(HttpNotFound()); } ViewBag.DiscountCode_idDiscountCode = new SelectList(db.DiscountCodes, "idDiscountCode", "code", discountCodeForItem.DiscountCode_idDiscountCode); ViewBag.Item_idItem = new SelectList(db.Items, "idItem", "name", discountCodeForItem.Item_idItem); return(View(discountCodeForItem)); }