Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public ActionResult TypeRegister(int type, int cutline)
        {
            if (ExistTypeRequirement(type)) return Json(new { result = "fail", message = "이미 존재합니다." }, JsonRequestBehavior.AllowGet);
            LectureTypeRequirementItem item = new LectureTypeRequirementItem();
            item.LectureTypeId = type;
            item.Cutline = cutline;
            item.AccountId = accountItem.Id;

            try
            {
                LectureTypeRequirementDao.Insert(item);
                return Json(new { result = "success" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception ex)
            {
                return Json(new { result = "fail", message = ex.Message }, JsonRequestBehavior.AllowGet);
            }
        }
Exemplo n.º 3
0
 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);
     }
 }
Exemplo n.º 4
0
 private bool ExistTypeRequirement(int type)
 {
     LectureTypeRequirementItem item = LectureTypeRequirementDao.FindByAccountAndTypeId(accountItem.Id, type);
     return item != null;
 }