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(); }
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(); }
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; }
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(); }
public CreateGroupCommandHandler(CampusDbContext context) { _context = context; }
public GetAllAcademicDegreesQueryHandler(CampusDbContext context) { _context = context; }
public DeleteLectorSubjectCommandHandler(CampusDbContext context) { _context = context; }
public GetUserQueryHandler(CampusDbContext context, IPasswordHasher passwordHasher) { _context = context; _passwordHasher = passwordHasher; }
public GetGroupDetailQueryHandler(CampusDbContext context) { _context = context; }
public GetLessonQueryHandler(CampusDbContext context) { _context = context; }
public GetAllLessonTypesQueryHandler(CampusDbContext context) { _context = context; }
public GetAllGroupsQueryHandler(CampusDbContext context) { _context = context; }
public SendResetedPasswordCommandHandler(CampusDbContext context, INotificationService notificationService) { _context = context; _notificationService = notificationService; }
public DeleteLessonCommandHandler(CampusDbContext context) { _context = context; }
public GetAllDayOfWeeksQueryHandler(CampusDbContext context) { _context = context; }
public GetLectorDetailQueryHandler(CampusDbContext context) { _context = context; }
public GetAllAttendancesQueryHandler(CampusDbContext context) { _context = context; }
public GetAllEducationalDegreesQueryHandler(CampusDbContext context) { _context = context; }
public UpdateLectorCommandHandler(CampusDbContext context) { _context = context; }
public GetAllSubjectsQueryHandler(CampusDbContext context) { _context = context; }
public CreateSubjectCommandHandler(CampusDbContext context) { _context = context; }
public DeleteSpecialityCommandHandler(CampusDbContext context) { _context = context; }
public GetAllLectorsQueryHandler(CampusDbContext context) { _context = context; }
public GetAllWeatherTypesQueryHandler(CampusDbContext context) { _context = context; }
public GetSpecialityQueryHandler(CampusDbContext context) { _context = context; }
public SendPasswordToNewLectorCommandHandler(CampusDbContext context, INotificationService notificationService) { _context = context; _notificationService = notificationService; }
public GetLectorsGroupsQueryHandler(CampusDbContext context) { _context = context; }
public GetLectorsLessonsByGroupQueryHandler(CampusDbContext context) { _context = context; }
public DeleteAttendanceCommandHandler(CampusDbContext context) { _context = context; }
public GetLectorSubjectQueryHandler(CampusDbContext context) { _context = context; }