public void Run() { Console.WriteLine("{0,55}", "/// VISIT LESSON. ///"); Console.WriteLine(); _book = new Book(); _student = new Student(); _lesson = new Lesson(); _visitedLesson = new VisitedLessonsList(); int _studentId = new Functions().ChooseStudent(); //return ID student _student = new Functions().SelectOneStudent(_studentId); //return object Student AddStudentToVisitedLesson(_studentId); new Functions().OutputStudent(_student); int _lessonId = new Functions().ChooseLesson(); _lesson = new Functions().SelectOneLesson(_lessonId); AddLessonToVisitedLesson(_lessonId); new Functions().OutputLesson(_lesson); int _bookId = new Functions().ChooseBook(_studentId); _book = new Functions().SelectOneBook(_bookId); AddBookToVisitedLesson(_bookId); new Functions().OutputBook(_book); SaveChanges(); }
public void Insert(VisitedLessonsList _visitedLesson) { using (StudentContext db = new StudentContext()) { db.Database.ExecuteSqlCommand(@"Insert into VisitedLessonsLists (StudentId, LessonId,BookId) Values({0},{1},{2})", _visitedLesson.StudentId, _visitedLesson.LessonId, _visitedLesson.BookId); } }