public JsonResult UpdateSubject(Subject subject) { if (subject == null) { return(Json(new { Message = "Error", HasError = true }, JsonRequestBehavior.AllowGet)); } var dao = new SubjectDAO(); var message = dao.UpdateSubject(subject); return(Json(new { Message = message }, JsonRequestBehavior.AllowGet)); }
// GET: Admin/Users/Edit public ActionResult Edit(Subject sub) { if (ModelState.IsValid) { var dao = new SubjectDAO(); sub.CreateDate = DateTime.Now; sub.SkipSwap = false; sub.clogic = false; sub.AnswerOption = false; sub.NoOfAnswers = 4; sub.roundToZero = false; sub.skipMinus = false; if (dao.UpdateSubject(sub)) { return(RedirectToAction("Index", "Subject")); } else { ModelState.AddModelError("", "Chỉnh sửa môn thi thất bại"); } } return(View("Index")); }