Beispiel #1
0
        private async Task <AdaptCourseData> GetAdaptCourseDataAsync(string courseId)
        {
            var course = await CourseService.GetPackageAsync(courseId, true);

            var pages = await CourseService.GetPagesAsync(courseId, true);

            return(AdaptService.GenerateCourseData(pages, course));
        }
        public async Task <GenerateResultModel> GeneratePackageDataAsync(string courseId, bool usePreview, CourseFileTypeEnum type)
        {
            if (string.IsNullOrEmpty(courseId))
            {
                throw new NotSupportedException($"Please specify '{nameof(courseId)}' parameter");
            }

            var course = await CourseService.GetPackageAsync(courseId, usePreview);

            var pages = await CourseService.GetPagesAsync(courseId, usePreview);

            var courseData = AdaptService.GenerateCourseData(pages, course);

            // (re)generate course json files
            FileService.CreateCourseJsonFiles(course.CourseId, course.Language?.FirstOrDefault()?.Codename, type, courseData);

            return(new GenerateResultModel()
            {
                Course = course,
                CourseData = courseData
            });
        }