Ejemplo n.º 1
0
        static void DeleteCourse(ApplicationDbContext db, CourseModel course)
        {
            var mods = course.Modules.ToList();

            foreach (var mod in mods)
            {
                ModuleController.DeleteModule(db, mod);
            }

            var docs = course.Documents.ToList();

            foreach (var doc in docs)
            {
                DocumentController.DeleteDocument(db, doc);
            }

            var students = course.Students.ToList();

            foreach (var stud in students)
            {
                db.Users.Remove(stud);
            }

            db.Courses.Remove(course);
        }
Ejemplo n.º 2
0
        public static void DeleteActivity(ApplicationDbContext db, ActivityModel activity)
        {
            var docs = activity.Documents.ToList();

            foreach (var doc in docs)
            {
                DocumentController.DeleteDocument(db, doc);
            }

            db.Activities.Remove(activity);
        }
Ejemplo n.º 3
0
        public static void DeleteModule(ApplicationDbContext db, ModuleModel module)
        {
            var activities = module.Activities.ToList();

            foreach (var act in activities)
            {
                ActivityController.DeleteActivity(db, act);
            }

            var docs = module.Documents.ToList();

            foreach (var doc in docs)
            {
                DocumentController.DeleteDocument(db, doc);
            }

            db.Modules.Remove(module);
        }