public ActionResult Delete(int id) { DeThiDAO dao = new DeThiDAO(); dao.Delete(id); return(RedirectToAction("Index")); }
public ActionResult Create(DeThi collection) { try { // TODO: Add insert logic here if (ModelState.IsValid) { //collection.NgayTao = DateTime.Now; DeThiDAO tan = new DeThiDAO(); int id = tan.Insert(collection); if (id > 0) { return(RedirectToAction("Index", "DeThi")); } else { ModelState.AddModelError("", "Thêm thất bại"); } } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult EditActionDT(DeThi hsu) { DeThiDAO dao = new DeThiDAO(); dao.Update(hsu); return(RedirectToAction("Index")); }
// GET: DeThi public ActionResult Index() { DeThiDAO dt = new DeThiDAO(); var model = dt.ListDeThi(); return(View(model)); }
public ActionResult Edit(int id) { DeThiDAO dao = new DeThiDAO(); DeThi model = dao.FindDeThiById(id); SetViewBagDD(); return(View(model)); }
public ActionResult Details(int id) { DeThiDAO dt = new DeThiDAO(); var model = dt.ListQuizID(id); SetViewBagDD(); return(View(model)); }
public ActionResult AddQuiz(ch_db collection) { try { if (ModelState.IsValid) { DeThiDAO tan = new DeThiDAO(); int id = tan.InsertID(collection); if (id > 0) { return(RedirectToAction("Details/" + Url.RequestContext.RouteData.Values["ID"], "DeThi")); } else { ModelState.AddModelError("", "Thêm thất bại"); } } return(RedirectToAction("Index")); } catch { return(View()); } }
public void SetViewBagMD(int selectedID) { var db = new DeThiDAO(); ViewBag.MaDe = new SelectList(db.ListDeThi(), "MaDe", "MoTa", selectedID); }