Beispiel #1
0
        public ActionResult DeleteConfirmed(long id)
        {
            khuyenmai khuyenmai = db.khuyenmais.Find(id);

            db.khuyenmais.Remove(khuyenmai);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit(khuyenmai model)
 {
     if (ModelState.IsValid)
     {
         db.Entry(model).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ModelState.AddModelError("", "Thông tin không chính xác");
     return(View(model));
 }
Beispiel #3
0
 public ActionResult Create(khuyenmai model)
 {
     if (ModelState.IsValid)
     {
         db.khuyenmais.Add(model);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ModelState.AddModelError("", "Thông tin nhập liệu không chính xác ! Hãy xem lại .");
     return(View());
 }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "khuyenmai_id,tenkhuyenmai,ngaybatdau,ngayketthuc,muckhuyenmaitoida,merchant_id")] khuyenmai khuyenmai)
 {
     if (ModelState.IsValid)
     {
         db.Entry(khuyenmai).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.merchant_id = new SelectList(db.merchants, "merchant_id", "cmnd", khuyenmai.merchant_id);
     return(View(khuyenmai));
 }
Beispiel #5
0
        // GET: khuyenmais/Delete/5
        public ActionResult Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            khuyenmai khuyenmai = db.khuyenmais.Find(id);

            if (khuyenmai == null)
            {
                return(HttpNotFound());
            }
            return(View(khuyenmai));
        }
Beispiel #6
0
        // GET: khuyenmais/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            khuyenmai khuyenmai = db.khuyenmais.Find(id);

            if (khuyenmai == null)
            {
                return(HttpNotFound());
            }
            ViewBag.merchant_id = new SelectList(db.merchants, "merchant_id", "cmnd", khuyenmai.merchant_id);
            return(View(khuyenmai));
        }