コード例 #1
0
        public ActionResult Update(int id, string score, int category, [DefaultValue(0)] int type, string title, [DefaultValue(0)] int section, int credit)
        {
            LectureDetailItem beforeItem = LectureDetailDao.FindById(id);

            if (!title.Equals(beforeItem.Name) && ExistLectureDetail(title))
            {
                return(Json(new { result = "fail", message = "이미 존재합니다." }, JsonRequestBehavior.AllowGet));
            }
            LectureDetailItem item = new LectureDetailItem();

            item.LectureCategoryId = category;
            item.LectureTypeId     = type;
            item.Score             = score;
            item.Name      = title;
            item.SectionId = section;
            item.Credit    = credit;
            item.AccountId = accountItem.Id;
            item.Id        = id;
            try
            {
                LectureDetailDao.Update(item);
                return(Json(new { result = "success" }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(Json(new { result = "fail", message = ex.Message }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #2
0
        public ActionResult Update(int id)
        {
            LectureDetailItem           item         = LectureDetailDao.FindById(id);
            IList <LectureCategoryItem> categoryList = LectureCategoryDao.FindAll();
            IList <LectureTypeItem>     typeList     = LectureTypeDao.FindByCategoryId(item.LectureCategoryId);
            IList <SectionItem>         sectionList  = SectionDao.FindByTypeId(item.LectureTypeId);

            ViewBag.categoryList = categoryList;
            ViewBag.Item         = item;
            ViewBag.typeList     = typeList;
            ViewBag.sectionList  = sectionList;
            return(View());
        }