public ActionResult TypeUpdate(int id) { LectureTypeRequirementItem item = LectureTypeRequirementDao.FindById(id); IList<LectureCategoryItem> categoryList = LectureCategoryDao.FindLectureTypeExist(); IList<LectureTypeItem> typeList = LectureTypeDao.FindByCategoryId(item.LectureCategoryId); ViewBag.categoryList = categoryList; ViewBag.Item = item; ViewBag.typeList = typeList; return View(); }
public ActionResult TypeUpdate(int id, int type, int cutline) { LectureTypeRequirementItem beforeItem = LectureTypeRequirementDao.FindById(id); if (beforeItem.LectureTypeId != type && ExistTypeRequirement(type)) return Json(new { result = "fail", message = "이미 존재합니다." }, JsonRequestBehavior.AllowGet); LectureTypeRequirementItem item = new LectureTypeRequirementItem(); item.LectureTypeId = type; item.Cutline = cutline; item.AccountId = accountItem.Id; item.Id = id; try { LectureTypeRequirementDao.Update(item); return Json(new { result = "success" }, JsonRequestBehavior.AllowGet); } catch (Exception ex) { return Json(new { result = "fail", message = ex.Message }, JsonRequestBehavior.AllowGet); } }