Exemplo n.º 1
0
        public void Run()
        {
            using (var context = new SchoolContext())
            {
                IStudentRepo studentRepo = new StudentRepo(context);
                ICourseRepo  courseRepo  = new CourseRepo(context);
                using (IUoW uow = new UoW(context, studentRepo, courseRepo))
                {
                    var s = uow.StudentRepo.Get().First();

                    s.AddCard(Guid.NewGuid().ToString().Substring(0, 10));

                    uow.StudentRepo.PrintStudents();

                    //uow.Commit();
                }
            }
        }
Exemplo n.º 2
0
        public void Run()
        {
            using (var context = new SchoolContext())
            {
                IStudentRepo studentRepo = new StudentRepo(context);
                ICourseRepo  courseRepo  = new CourseRepo(context);
                using (IUoW uow = new UoW(context, studentRepo, courseRepo))
                {
                    var s = uow.StudentRepo.Get(6);
                    Console.WriteLine(s.ToString());
                    Course course = new Course("How to basic");
                    uow.CourseRepo.Add(course);
                    var participation = new CourseParticipation(s, course);
                    s.AddParticipation(participation);
                    course.AddParticipation(participation);
                    //uow.Commit();

                    uow.StudentRepo.PrintStudents();
                }
            }
        }