public void CreateCourse(Course t)
 {
     using (IDataContext ctx = DataContext.Instance())
     {
         var rep = ctx.GetRepository<Course>();
         rep.Insert(t);
     }
 }
Example #2
0
 /// <summary>
 /// Loads an existing Course in the language cultureCode
 /// Only loads the CourseEntity.
 /// </summary>
 /// <param name="cultureCode"></param>
 /// <param name="CourseId"></param>
 public CourseContainer(string cultureCode, int CourseId)
 {
     BaseRepository rep = new BaseRepository();
     CultureCode = cultureCode;
     TheCourse = rep.GetCourse(CourseId);
 }
Example #3
0
 /// <summary>
 /// Base constructor. Creates a new Course in the language cultureCode.
 /// </summary>
 /// <param name="cultureCode"></param>
 public CourseContainer(string cultureCode)
 {
     TheCourse = new Course();
     CultureCode = cultureCode;
 }
Example #4
0
        public void DeleteCourse(Course c)
        {
            // Todo: Don't delete Course if: It has comments or ratings
            if (c == null)
            {
                throw new Exception("Cannot delete: Course not initialized");
            }

            //Delete Course page
            if (c.TabId != 0)
            {
                DNNHelper h = new DNNHelper();
                h.DeleteTab(c.TabId);
            }

            rep.DeleteAllPhTextForItem(c.CourseId, ETextItemType.CourseTitle);
            rep.DeleteAllPhTextForItem(c.CourseId, ETextItemType.CourseDescription);
            rep.DeleteAllPhTextForItem(c.CourseId, ETextItemType.CourseRichRichText);
            var CPEs = GetCPEsInCourse(c.CourseId);
            foreach (CoursePluggEntity cp in CPEs)
            {
                rep.DeleteAllPhTextForItem(cp.CoursePluggId, ETextItemType.CoursePluggText);
                rep.DeleteCoursePlugg(cp);
            }

            rep.DeleteCourse(c);
        }