public ActionResult Edit(string DiscountID)
        {
            DiscountCodeBLL bll = new DiscountCodeBLL();
            var             dis = bll.Find(DiscountID);

            return(View(dis));
        }
        public ActionResult Delete(DiscountModel model)
        {
            DiscountCodeBLL bll = new DiscountCodeBLL();

            bll.Delete(model.discountID);
            return(RedirectToAction("Index"));
        }
 public ActionResult Create(Discount discount)
 {
     try
     {
         if (ModelState.IsValid)
         {
             DiscountCodeBLL bll    = new DiscountCodeBLL();
             int             result = bll.CheckIdExisted(discount.discountID);
             if (result == 0)
             {
                 bll.Insert(discount);
                 return(RedirectToAction("Index"));
             }
             else
             {
                 ModelState.AddModelError("", "ID EXISTED");
             }
             return(View(discount));
         }
         return(View());
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult Edit(Discount dis)
        {
            if (ModelState.IsValid)
            {
                DiscountCodeBLL bll = new DiscountCodeBLL();
                bll.Update(dis);
                return(RedirectToAction("Index"));
            }

            return(View(dis));
        }
        // GET: Admin/Discount
        public ActionResult Index()
        {
            var dll   = new DiscountCodeBLL();
            var model = new DiscountModel();

            model.currentPage = 1;
            model.totalPage   = dll.CountPage("");
            model.list        = dll.GetList(1, "");

            return(View(model));
        }
        public ActionResult Index(DiscountModel model)
        {
            if (model.searchWord == null)
            {
                model.searchWord = "";
            }
            if (model.currentPage == 0)
            {
                model.currentPage = 1;
            }
            var dll = new DiscountCodeBLL();

            model.totalPage = dll.CountPage(model.searchWord);
            model.list      = dll.GetList(model.currentPage, model.searchWord);
            return(View(model));
        }