public InitialHostDbBuilder(SchoolDbContext context) { _context = context; }
public ExamController(SchoolDbContext context) { _context = context; }
private Dictionary <int, BudgetEntity> GetBudgetByFiscalYearMapping(SchoolDbContext dbContext, DistrictEntity district) { return(dbContext.Set <BudgetEntity>() .Where(x => x.DistrictId == district.DistrictId) .ToDictionary(x => x.FiscalYearId, x => x)); }
private void ResetDb() { this.db.SaveChanges(); this.db = new SchoolDbContext(); }
public ProfessorManager(SchoolDbContext dbContext) { _dbContext = dbContext; }
public FiscalYearRepository(SchoolDbContext dbContext) { DbContext = dbContext; }
public AdministrationService(SchoolDbContext dbContext) { this._dbContext = dbContext; }
public HostRoleAndUserCreator(SchoolDbContext context) { _context = context; }
public StudentformFieldModule(SchoolDbContext context) { _context = context; }
public BudgetExpendituresRepository(SchoolDbContext dbContext) { DbContext = dbContext; }
public ProfessorsController(SchoolDbContext context) { _professorManager = new ProfessorManager(context); }
public ClassroomAPIController(SchoolDbContext context) { _context = context; }
public StudentRepository(SchoolDbContext dbContext) { _dbContext = dbContext; }
public SchoolRepository(SchoolDbContext schoolDbContext) { _schoolDbContext = schoolDbContext; }
public RegParentRepo(SchoolDbContext db) : base(db) { _db = db; }
public UserSchoolRepo(SchoolDbContext db) : base(db) { _db = db; }
public LkpDocumentRepo(SchoolDbContext context) : base(context) { _db = context; }
public ClassAssignRepository(SchoolDbContext ctx) { context = ctx; }
public StudentService(SchoolDbContext context) { _context = context; }
public StudentApiController(SchoolDbContext schoolDbContext) { _schoolDbContext = schoolDbContext; }
public CoursesController(SchoolDbContext schoolDbContext) { _schoolDbContext = schoolDbContext; }
public TeacherAPIController(SchoolDbContext context) { _context = context; }
public PaiementForRepository(SchoolDbContext ctx) { context = ctx; }
public FormPageModule(SchoolDbContext context) { _context = context; }
public TechnologiesApiController(SchoolDbContext context, ITechnologyRepository technologyRepository) { _context = context; this.technologyRepository = technologyRepository; }
public StudentsController(SchoolDbContext context) { _context = context; }
public GradeRepository(SchoolDbContext context) { _context = context; }
public StudentsController(SchoolDbContext context) { _studentManager = new StudentManager(context); }
public FormFieldTypeModule(SchoolDbContext context) { _context = context; }
public DatabaseStudentRepository(SchoolDbContext context) { _context = context; }
public static void Initialize(SchoolDbContext context) { context.Database.EnsureCreated(); // 检查是否有学生信息 if (context.Students.Any()) { return; //返回,不执行。 } #region 添加种子学生信息 var students = new[] { new Student { RealName = "龙傲天", EnrollmentDate = DateTime.Parse("2005-09-01") }, new Student { RealName = "王尼玛", EnrollmentDate = DateTime.Parse("2002-09-01") }, new Student { RealName = "张全蛋", EnrollmentDate = DateTime.Parse("2003-09-01") }, new Student { RealName = "叶良辰", EnrollmentDate = DateTime.Parse("2002-09-01") }, new Student { RealName = "和珅", EnrollmentDate = DateTime.Parse("2002-09-01") }, new Student { RealName = "纪晓岚", EnrollmentDate = DateTime.Parse("2001-09-01") }, new Student { RealName = "李逍遥", EnrollmentDate = DateTime.Parse("2003-09-01") }, new Student { RealName = "王小虎", EnrollmentDate = DateTime.Parse("2005-09-01") } }; foreach (var s in students) { context.Students.Add(s); } context.SaveChanges(); #endregion #region 添加种子老师信息 var instructors = new[] { new Instructor { RealName = "孔子", HireDate = DateTime.Parse("1995-03-11") }, new Instructor { RealName = "墨子", HireDate = DateTime.Parse("2003-03-11") }, new Instructor { RealName = "荀子", HireDate = DateTime.Parse("1990-03-11") }, new Instructor { RealName = "鬼谷子", HireDate = DateTime.Parse("1985-03-11") }, new Instructor { RealName = "孟子", HireDate = DateTime.Parse("2003-03-11") }, new Instructor { RealName = "朱熹", HireDate = DateTime.Parse("2003-03-11") } }; foreach (var i in instructors) { context.Instructors.Add(i); } context.SaveChanges(); #endregion #region 添加部门的种子的数据 var departments = new[] { new Department { Name = "论语", Budget = 350000, StartDate = DateTime.Parse("2017-09-01"), InstructorId = instructors.Single(i => i.RealName == "孟子").Id }, new Department { Name = "兵法", Budget = 100000, StartDate = DateTime.Parse("2017-09-01"), InstructorId = instructors.Single(i => i.RealName == "鬼谷子").Id }, new Department { Name = "文言文", Budget = 350000, StartDate = DateTime.Parse("2017-09-01"), InstructorId = instructors.Single(i => i.RealName == "朱熹").Id }, new Department { Name = "世界和平", Budget = 100000, StartDate = DateTime.Parse("2017-09-01"), InstructorId = instructors.Single(i => i.RealName == "墨子").Id } }; foreach (var d in departments) { context.Departments.Add(d); } context.SaveChanges(); #endregion var courses = new[] { new Course { CourseId = 1050, Title = "数学", Credits = 3, DepartmentId = departments.Single(s => s.Name == "兵法").Id }, new Course { CourseId = 4022, Title = "政治", Credits = 3, DepartmentId = departments.Single(s => s.Name == "文言文").Id }, new Course { CourseId = 4041, Title = "物理", Credits = 3, DepartmentId = departments.Single(s => s.Name == "兵法").Id }, new Course { CourseId = 1045, Title = "化学", Credits = 4, DepartmentId = departments.Single(s => s.Name == "世界和平").Id }, new Course { CourseId = 3141, Title = "生物", Credits = 4, DepartmentId = departments.Single(s => s.Name == "论语").Id }, new Course { CourseId = 2021, Title = "英语", Credits = 3, DepartmentId = departments.Single(s => s.Name == "论语").Id }, new Course { CourseId = 2042, Title = "历史", Credits = 4, DepartmentId = departments.Single(s => s.Name == "文言文").Id } }; foreach (var c in courses) { context.Courses.Add(c); } context.SaveChanges(); #region 办公室分配的种子数据 var officeAssignments = new[] { new OfficeAssignment { InstructorId = instructors.Single(i => i.RealName == "孟子").Id, Location = "逸夫楼 17" }, new OfficeAssignment { InstructorId = instructors.Single(i => i.RealName == "朱熹").Id, Location = "青霞路 27" }, new OfficeAssignment { InstructorId = instructors.Single(i => i.RealName == "墨子").Id, Location = "天府楼 304" } }; foreach (var o in officeAssignments) { context.OfficeAssignments.Add(o); } context.SaveChanges(); #endregion #region 课程老师的种子数据 var courseInstructors = new[] { new CourseAssignment { CourseId = courses.Single(c => c.Title == "数学").CourseId, InstructorId = instructors.Single(i => i.RealName == "鬼谷子").Id }, new CourseAssignment { CourseId = courses.Single(c => c.Title == "数学").CourseId, InstructorId = instructors.Single(i => i.RealName == "墨子").Id }, new CourseAssignment { CourseId = courses.Single(c => c.Title == "政治").CourseId, InstructorId = instructors.Single(i => i.RealName == "朱熹").Id }, new CourseAssignment { CourseId = courses.Single(c => c.Title == "化学").CourseId, InstructorId = instructors.Single(i => i.RealName == "墨子").Id }, new CourseAssignment { CourseId = courses.Single(c => c.Title == "生物").CourseId, InstructorId = instructors.Single(i => i.RealName == "孟子").Id }, new CourseAssignment { CourseId = courses.Single(c => c.Title == "英语").CourseId, InstructorId = instructors.Single(i => i.RealName == "孟子").Id }, new CourseAssignment { CourseId = courses.Single(c => c.Title == "物理").CourseId, InstructorId = instructors.Single(i => i.RealName == "鬼谷子").Id }, new CourseAssignment { CourseId = courses.Single(c => c.Title == "历史").CourseId, InstructorId = instructors.Single(i => i.RealName == "朱熹").Id } }; foreach (var ci in courseInstructors) { context.CourseAssignments.Add(ci); } context.SaveChanges(); #endregion var enrollments = new[] { new Enrollment { StudentId = students.Single(s => s.RealName == "龙傲天").Id, CourseId = courses.Single(c => c.Title == "数学").CourseId, Grade = CourseGrade.A }, new Enrollment { StudentId = students.Single(s => s.RealName == "龙傲天").Id, CourseId = courses.Single(c => c.Title == "政治").CourseId, Grade = CourseGrade.C }, new Enrollment { StudentId = students.Single(s => s.RealName == "龙傲天").Id, CourseId = courses.Single(c => c.Title == "物理").CourseId, Grade = CourseGrade.D }, new Enrollment { StudentId = students.Single(s => s.RealName == "王尼玛").Id, CourseId = courses.Single(c => c.Title == "物理").CourseId, Grade = CourseGrade.F }, new Enrollment { StudentId = students.Single(s => s.RealName == "王尼玛").Id, CourseId = courses.Single(c => c.Title == "化学").CourseId }, new Enrollment { StudentId = students.Single(s => s.RealName == "王尼玛").Id, CourseId = courses.Single(c => c.Title == "生物").CourseId }, new Enrollment { StudentId = students.Single(s => s.RealName == "叶良辰").Id, CourseId = courses.Single(c => c.Title == "英语").CourseId, Grade = CourseGrade.A }, new Enrollment { StudentId = students.Single(s => s.RealName == "叶良辰").Id, CourseId = courses.Single(c => c.Title == "历史").CourseId, Grade = CourseGrade.D }, new Enrollment { StudentId = students.Single(s => s.RealName == "张全蛋").Id, CourseId = courses.Single(c => c.Title == "英语").CourseId, Grade = CourseGrade.B }, new Enrollment { StudentId = students.Single(s => s.RealName == "张全蛋").Id, CourseId = courses.Single(c => c.Title == "数学").CourseId, Grade = CourseGrade.A }, new Enrollment { StudentId = students.Single(s => s.RealName == "纪晓岚").Id, CourseId = courses.Single(c => c.Title == "英语").CourseId }, new Enrollment { StudentId = students.Single(s => s.RealName == "王小虎").Id, CourseId = courses.Single(c => c.Title == "生物").CourseId }, new Enrollment { StudentId = students.Single(s => s.RealName == "和珅").Id, CourseId = courses.Single(c => c.Title == "物理").CourseId, Grade = CourseGrade.A }, new Enrollment { StudentId = students.Single(s => s.RealName == "和珅").Id, CourseId = courses.Single(c => c.Title == "英语").CourseId } }; foreach (var e in enrollments) { context.Enrollments.Add(e); } context.SaveChanges(); }
public StudentFeeRepo(SchoolDbContext db) : base(db) { _db = db; }
public ClassRepository(SchoolDbContext dbContext) { _dbContext = dbContext; }