コード例 #1
0
        public static void LoadSpecialitiesTestData(CampusDbContext context)
        {
            context.Specialities.Add(new Speciality {
                Id = 1, Name = "Test Speciality 1", Code = 100
            });
            context.Specialities.Add(new Speciality {
                Id = 2, Name = "Test Speciality 2", Code = 101
            });

            context.EducationalDegrees.Add(new EducationalDegree {
                Id = 1, Name = "Educational Degree 1"
            });
            context.Groups.Add(new Group {
                Id = 1, EducationalDegreeId = 1, Name = "Group 1", SpecialityId = 2, StudentsCount = 10, Year = 1
            });

            context.SaveChanges();
        }
コード例 #2
0
        public static void LoadSubjectsTestData(CampusDbContext context)
        {
            context.AcademicRanks.Add(new AcademicRank {
                Id = 1, Name = "Academic rank 1"
            });
            context.AcademicDegrees.Add(new AcademicDegree {
                Id = 1, Name = "Academic degree 1"
            });
            context.Users.Add(new User {
                Id = 100, Email = "*****@*****.**", PasswordHash = "testPassword123", LastVisit = DateTime.Now
            });
            context.UserRoles.Add(new UserRole {
                RoleId = 1, UserId = 100
            });
            context.Lectors.Add(new Lector
            {
                Id               = 1,
                FirstName        = "Name 1",
                LastName         = "LastName 1",
                Patronymic       = "Patronymic 1",
                AcademicDegreeId = 1,
                AcademicRankId   = 1,
                UserId           = 100,
                Email            = "*****@*****.**",
                PhoneNumber      = "+99999999999"
            });
            context.LessonTypes.Add(new LessonType {
                Id = 1, Name = "Lesson type 1"
            });

            context.Subjects.Add(new Subject {
                Id = 1, Name = "Subject 1"
            });
            context.Subjects.Add(new Subject {
                Id = 2, Name = "Subject 2"
            });

            context.LectorSubjects.Add(new LectorSubject {
                LectorId = 1, SubjectId = 2
            });

            context.SaveChangesAsync();
        }
コード例 #3
0
ファイル: TestBase.cs プロジェクト: vandriiv/Campus
        protected void InitDbContext(bool useSqlLite = false)
        {
            var builder = new DbContextOptionsBuilder <CampusDbContext>();

            if (useSqlLite)
            {
                builder.UseSqlite("DataSource=:memory:", x => { });
            }
            else
            {
                builder.UseInMemoryDatabase(Guid.NewGuid().ToString());
            }

            var dbContext = new CampusDbContext(builder.Options);

            if (useSqlLite)
            {
                dbContext.Database.OpenConnection();
            }

            dbContext.Database.EnsureCreated();

            Context = dbContext;
        }
コード例 #4
0
        public static void LoadLectorSubjectsTestData(CampusDbContext context)
        {
            context.AcademicRanks.Add(new AcademicRank {
                Id = 1, Name = "Academic rank 1"
            });
            context.AcademicDegrees.Add(new AcademicDegree {
                Id = 1, Name = "Academic degree 1"
            });
            context.Users.Add(new User {
                Id = 100, Email = "*****@*****.**", PasswordHash = "testPassword123", LastVisit = DateTime.Now
            });
            context.UserRoles.Add(new UserRole {
                RoleId = 1, UserId = 100
            });

            context.Specialities.Add(new Speciality {
                Id = 1, Name = "Test Speciality 1", Code = 100
            });
            context.EducationalDegrees.Add(new EducationalDegree {
                Id = 1, Name = "Educational Degree 1"
            });
            context.Groups.Add(new Group {
                Id = 1, EducationalDegreeId = 1, Name = "Group 1", SpecialityId = 1, StudentsCount = 10, Year = 1
            });

            context.Lectors.Add(new Lector
            {
                Id               = 1,
                FirstName        = "Name 1",
                LastName         = "LastName 1",
                Patronymic       = "Patronymic 1",
                AcademicDegreeId = 1,
                AcademicRankId   = 1,
                UserId           = 100,
                Email            = "*****@*****.**",
                PhoneNumber      = "+99999999999"
            });
            context.LessonTypes.Add(new LessonType {
                Id = 1, Name = "Lesson type 1"
            });

            context.Subjects.Add(new Subject {
                Id = 1, Name = "Subject 1"
            });
            context.Subjects.Add(new Subject {
                Id = 2, Name = "Subject 2"
            });

            context.LectorSubjects.Add(new LectorSubject {
                Id = 1, LectorId = 1, SubjectId = 1, LessonTypeId = 1
            });
            context.LectorSubjects.Add(new LectorSubject {
                Id = 2, LectorId = 1, SubjectId = 2, LessonTypeId = 1
            });

            context.WeatherTypes.Add(new WeatherType {
                Id = 1, Name = "Weather type 1"
            });

            context.Lessons.Add(new Lesson {
                Id = 1, GroupId = 1, LectorSubjectId = 2
            });

            context.SaveChanges();
        }
コード例 #5
0
 public CreateGroupCommandHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #6
0
 public GetAllAcademicDegreesQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #7
0
 public DeleteLectorSubjectCommandHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #8
0
 public GetUserQueryHandler(CampusDbContext context, IPasswordHasher passwordHasher)
 {
     _context        = context;
     _passwordHasher = passwordHasher;
 }
コード例 #9
0
 public GetGroupDetailQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #10
0
 public GetLessonQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #11
0
 public GetAllLessonTypesQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #12
0
 public GetAllGroupsQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #13
0
 public SendResetedPasswordCommandHandler(CampusDbContext context, INotificationService notificationService)
 {
     _context             = context;
     _notificationService = notificationService;
 }
コード例 #14
0
 public DeleteLessonCommandHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #15
0
 public GetAllDayOfWeeksQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #16
0
 public GetLectorDetailQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #17
0
 public GetAllAttendancesQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #18
0
 public GetAllEducationalDegreesQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #19
0
 public UpdateLectorCommandHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #20
0
 public GetAllSubjectsQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #21
0
 public CreateSubjectCommandHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #22
0
 public DeleteSpecialityCommandHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #23
0
 public GetAllLectorsQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #24
0
 public GetAllWeatherTypesQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #25
0
 public GetSpecialityQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #26
0
 public SendPasswordToNewLectorCommandHandler(CampusDbContext context, INotificationService notificationService)
 {
     _context             = context;
     _notificationService = notificationService;
 }
コード例 #27
0
 public GetLectorsGroupsQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #28
0
 public GetLectorsLessonsByGroupQueryHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #29
0
 public DeleteAttendanceCommandHandler(CampusDbContext context)
 {
     _context = context;
 }
コード例 #30
0
 public GetLectorSubjectQueryHandler(CampusDbContext context)
 {
     _context = context;
 }