public JsonResult GetChapter(int chapterid) { LessonBll lbll = new LessonBll(); var lesson = lbll.Select(chapterid); if (lesson != null) { LessonUnitBll bll = new LessonUnitBll(); ChapterSet set = new ChapterSet(); set.courseId = lesson.CourseId; set.id = lesson.ID; set.name = lesson.Name; set.setTime = lesson.UpdateTime.ToString("yyyy-MM-dd HH:mm:ss"); set.pages = new List <Page>(); set.status = lesson.Status; set.processid = lesson.ProcessId; var units = bll.SelectUnitsByLesson(set.id, set.processid); if (units != null) { set.pages = units.Select(u => new Page { courseId = u.CourseId, lessonId = u.LessonId, id = u.Id, name = u.Name, pageNum = u.Index, thumbnail = string.IsNullOrEmpty(u.Screenshot) ? "" : (ConfigurationManager.AppSettings["OssHostUrl"] + u.Screenshot), approveType = u.ApproveStatus }).ToList(); } return(Json(new JsonResponse <ChapterSet> { State = true, ErrorCode = 0, ErrorMsg = "", Data = set })); } else { return(Json(new JsonResponse <ChapterSet> { State = false, ErrorCode = 0, ErrorMsg = "没有此数据", Data = null })); } }
public void TestMethod_SelectUnits() { LessonUnitBll bll = new LessonUnitBll(); var s = bll.SelectUnitsByLesson(9999, 1); }