public ActionResult DeleteConfirmed(int id)
        {
            MainPromotion mainPromotion = db.MainPromotion.Find(id);

            db.MainPromotion.Remove(mainPromotion);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,ProductID,Code,Quantity,Left")] MainPromotion mainPromotion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(mainPromotion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductID = new SelectList(db.Product, "ID", "Name", mainPromotion.ProductID);
     return(View(mainPromotion));
 }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MainPromotion mainPromotion = db.MainPromotion.Find(id);

            if (mainPromotion == null)
            {
                return(HttpNotFound());
            }
            return(View(mainPromotion));
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MainPromotion mainPromotion = db.MainPromotion.Find(id);

            if (mainPromotion == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ProductID = new SelectList(db.Product, "ID", "Name", mainPromotion.ProductID);
            return(View(mainPromotion));
        }