public static CourseSiteBuilder Build(CourseType courseType, Course course = null)
        {
            var result = new CourseSiteBuilder();

            switch (courseType)
            {
            case CourseType.NewUnpublished:
            {
                result.Unpublished().WithNewStatus();
                break;
            }

            case CourseType.NewPublished:
            {
                result.Published().WithNewStatus();
                break;
            }

            case CourseType.SuspensedUnpublished:
            {
                result.Unpublished().WithSuspensedStatus();
                break;
            }

            case CourseType.SuspensedPublished:
            {
                result.Published().WithSuspensedStatus();
                break;
            }

            case CourseType.RunningUnpublished:
            {
                result.Unpublished().WithRunningStatus();
                break;
            }

            case CourseType.RunningPublished:
            {
                result.Published().WithRunningStatus();
                break;
            }

            case CourseType.DiscontinuedUnpublished:
            {
                result.Unpublished().WithDiscontinuedStatus();
                break;
            }

            case CourseType.DiscontinuedPublished:
            {
                result.Published().WithDiscontinuedStatus();
                break;
            }
            }

            result._courseSite.Site = course?.Provider?.Sites?.FirstOrDefault();

            return(result);
        }
Beispiel #2
0
        public CourseBuilder AddCourseSites(params CourseType[] courseTypes)
        {
            var result = new List <CourseSite>(_course.CourseSites)
            {
            };

            result.AddRange(courseTypes.Select(c => (CourseSite)CourseSiteBuilder.Build(c, _course)));
            _course.CourseSites = result;
            return(this);
        }