public JsonResult Delete(int id) { KyHoc obj = db.KyHocs.Find(id); obj.Active = false; return(Json(db.SaveChanges())); }
public ActionResult DeleteConfirmed(string id) { KyHoc kyHoc = db.KyHocs.Find(id); db.KyHocs.Remove(kyHoc); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
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)); }
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")); }
// 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)); }
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)); }