/// <summary> /// 将数据映射为<see cref="ChapterDetails"/>类型对象 /// </summary> /// <param name="chapter"></param> /// <returns></returns> public ChapterDetails ConvertToChapterDetails() { if (Chapter == null) { return(null); } var details = new ChapterDetails { ChapterId = Chapter.ChapterId, Content = Chapter.Content, Count = Chapter.Count, CourseId = Chapter.CourseId, CreateTime = Chapter.CreateTime, ParentId = Chapter.ParentId, Status = Chapter.Status, Title = Chapter.Title, Video = Chapter.Video }; details.CourseTitle = GetCourseTitle(); details.ParentTitle = GetParentChapterTitle(); return(details); }
public async Task <IActionResult> OnGetAsync(long id, string?slug) { Chapter = await _chaptersRepo.GetChapterDetails(id, User.GetNumericId()); if (Chapter == null) { return(NotFound()); } var siblings = await _chaptersRepo.GetMicroSiblings(Chapter.StoryId, Chapter.Order); Chapter.Previous = siblings.FirstOrDefault(c => c.Order < Chapter.Order); Chapter.Next = siblings.FirstOrDefault(c => c.Order > Chapter.Order); return(Page()); }