Exemple #1
0
        public static ILessonInfo StartNewLesson(string subj_title, string theme, int numberOfHours, string gradeName, string homeTask, int teacherID)
        {
            using (SchoolJournalEntities context = new SchoolJournalEntities())
            {
                ObjectParameter output = new ObjectParameter("addedLesson_id", typeof(int));
                context.startNewLesson(subj_title, theme, numberOfHours, gradeName, homeTask, teacherID, output);
                context.SaveChanges();

                int lessonID = (int)output.Value;

                var lsn = (from lesson in context.Lessons where lesson.LessonID == lessonID select lesson).FirstOrDefault();
                return(new LessonInfo(lsn));
            }
        }
Exemple #2
0
        public static ILessonInfo StartNewLesson(string subj_title, string theme, int numberOfHours, string gradeName, string homeTask, int teacherID)
        {
            using (SchoolJournalEntities context = new SchoolJournalEntities())
            {
                ObjectParameter output = new ObjectParameter("addedLesson_id", typeof(int));
                context.startNewLesson(subj_title, theme, numberOfHours, gradeName, homeTask, teacherID, output);
                context.SaveChanges();

                int lessonID = (int)output.Value;

                var lsn = (from lesson in context.Lessons where lesson.LessonID==lessonID select lesson).FirstOrDefault();
                return new LessonInfo(lsn);
            }
        }