コード例 #1
0
        public JsonResult Delete(int id)
        {
            KyHoc obj = db.KyHocs.Find(id);

            obj.Active = false;
            return(Json(db.SaveChanges()));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(string id)
        {
            KyHoc kyHoc = db.KyHocs.Find(id);

            db.KyHocs.Remove(kyHoc);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "ma,ky_hoc,bat_dau,ket_thuc")] KyHoc kyHoc)
 {
     if (ModelState.IsValid)
     {
         db.Entry(kyHoc).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(kyHoc));
 }
コード例 #4
0
        public ActionResult Create([Bind(Include = "ma,ky_hoc,bat_dau,ket_thuc")] KyHoc kyHoc)
        {
            if (ModelState.IsValid)
            {
                db.KyHocs.Add(kyHoc);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(kyHoc));
        }
コード例 #5
0
 public ActionResult Edit(KyHoc obj)
 {
     if (obj.IDKyHoc > 0)
     {
         db.Entry(obj).State = EntityState.Modified;
     }
     else
     {
         db.KyHocs.Add(obj);
     }
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
コード例 #6
0
        // GET: Admin/Semesters/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            KyHoc kyHoc = db.KyHocs.Find(id);

            if (kyHoc == null)
            {
                return(HttpNotFound());
            }
            return(View(kyHoc));
        }
コード例 #7
0
        public ActionResult Edit(int?id)
        {
            KyHoc obj = new KyHoc();

            if (id.HasValue)
            {
                obj = db.KyHocs.Find(id);
            }
            if (obj == null)
            {
                return(HttpNotFound());
            }
            return(View(obj));
        }