Beispiel #1
0
        public LessonPlan CreateLessonPLan(LessonPlanCreationDTO createDTO)
        {
            LessonPlan newLesson = new LessonPlan()
            {
                LessonPlanId          = CreateId(5),
                Title                 = createDTO.name,
                CompleteLessonPlanURL = createDTO.CompleteDocumentURL,
                OutlineURl            = createDTO.DocumentOutlineURL,
                ImageURL              = createDTO.DocumentOutlinePicture
            };

            while (Data.Lessonplans.Find(newLesson.LessonPlanId) != null)
            {
                newLesson.LessonPlanId = newLesson.LessonPlanId * 10;
            }
            Data.Database.OpenConnection();
            try
            {
                Data.Add(newLesson);
                Data.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.Lessonplans ON");

                Data.SaveChanges();
                Data.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.Poems OFF");
            }
            catch
            {
                return(null);
            }
            finally
            {
                Data.Database.CloseConnection();
            }
            return(newLesson);
        }
Beispiel #2
0
        public LessonPlan SaveLessonPLan(LessonPlanCreationDTO createDTO)
        {
            LessonPlan lessonPlan = CreateLessonPLan(createDTO);

            if (lessonPlan == null)
            {
                return(null);
            }

            themeManager.ConnectEntity(createDTO.themes, lessonPlan.LessonPlanId, "Lesson Plan");
            bool ConnectionsCreateResult = CreateConnections(createDTO.documentIds, lessonPlan);

            if (ConnectionsCreateResult == false)
            {
                return(null);
            }

            return(lessonPlan);
        }