Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            BangTheoDoiToCat bangTheoDoiToCat = db.BangTheoDoiToCats.Find(id);

            db.BangTheoDoiToCats.Remove(bangTheoDoiToCat);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public ActionResult Update(BangTheoDoiToCat bangTheoDoiToCat)
        {
            if (ModelState.IsValid)
            {
                _context.Entry(bangTheoDoiToCat).State = EntityState.Modified;
                _context.SaveChanges();
            }

            return(Json(bangTheoDoiToCat, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        public ActionResult Create([Bind(Exclude = "MaChuyen")] BangTheoDoiToCat bangTheoDoiToCat)
        {
            if (ModelState.IsValid)
            {
                _context.BangTheoDoiToCats.Add(bangTheoDoiToCat);
                _context.SaveChanges();
            }

            return(Json(bangTheoDoiToCat, JsonRequestBehavior.AllowGet));
        }
Esempio n. 4
0
 public ActionResult Edit([Bind(Include = "MaChuyen,MaHang,SLKeHoach,ThucHien,LuyKeThucHien,DenBaoCapBTP")] BangTheoDoiToCat bangTheoDoiToCat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bangTheoDoiToCat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaHang = new SelectList(db.BangTenMatHangs, "MaHang", "TenHang", bangTheoDoiToCat.MaHang);
     return(View(bangTheoDoiToCat));
 }
Esempio n. 5
0
        // GET: BangTheoDoiToCats/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BangTheoDoiToCat bangTheoDoiToCat = db.BangTheoDoiToCats.Find(id);

            if (bangTheoDoiToCat == null)
            {
                return(HttpNotFound());
            }
            return(View(bangTheoDoiToCat));
        }
Esempio n. 6
0
        // GET: BangTheoDoiToCats/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BangTheoDoiToCat bangTheoDoiToCat = db.BangTheoDoiToCats.Find(id);

            if (bangTheoDoiToCat == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MaHang = new SelectList(db.BangTenMatHangs, "MaHang", "TenHang", bangTheoDoiToCat.MaHang);
            return(View(bangTheoDoiToCat));
        }
Esempio n. 7
0
        public JsonResult Update(string model)
        {
            JavaScriptSerializer serializer  = new JavaScriptSerializer();
            BangTheoDoiToCat     bangtheodoi = serializer.Deserialize <BangTheoDoiToCat>(model);

            //save db...
            var entity = _context.BangTheoDoiToCats.Single(x => x.MaChuyen == bangtheodoi.MaChuyen);

            if (model.Contains("LuyKeThucHien"))
            {
                entity.LuyKeThucHien = bangtheodoi.LuyKeThucHien;
            }
            else if (model.Contains("SLKeHoach"))
            {
                entity.SLKeHoach = bangtheodoi.SLKeHoach;
            }
            else if (model.Contains("ThucHien"))
            {
                entity.ThucHien = bangtheodoi.ThucHien;
            }
            _context.SaveChanges();

            return(Json(new { status = true }, JsonRequestBehavior.AllowGet));
        }