直接代码:
//获取教材下的章跟篇 IList<Chapter> chapters = EntAppFrameWorkContext.DomainModelService.ExtenedService<IEbookManage>() .SearchChapterAndPartByEbookId(ebook.Key); Dictionary<Chapter,IList<KeyToChaSec>> dictionary=new Dictionary<Chapter, IList<KeyToChaSec>>(); //根据章跟篇获取可用的知识点目录关系 foreach (var chapter in chapters) { IList<KeyToChaSec> keyToChaSecs = EntAppFrameWorkContext.DomainModelService.ExtenedService<IEbookManage>() .SearchAllValidKeyToChaSecByChapterOrPart(chapter.Key); dictionary.Add(chapter,keyToChaSecs); } var jsons = from dic in dictionary select new { ChapterID=dic.Key.Key, ChapterName=dic.Key.Name, KnowledgePoints=( from keyToChaSec in dic.Value select new { ID = keyToChaSec.KeyPoint.Key, KnowledgePointRef = @"xhtml/" + keyToChaSec.ChpSect.PositionPage.Key + ".xhtml#kp" + keyToChaSec.KeyPoint.Key, ChapterName = keyToChaSec.ChpSect.Name, ChapterID = keyToChaSec.ChpSect.Key, KnowledgePoint = keyToChaSec.KeyPoint.Name }) };
时间: 2024-11-05 12:14:27