コード例 #1
0
        public static void Initialize(VogCodeChallengeDbContext _context)
        {

            if (_context.Departments.Any())
            {
                return;
            }

            _context.Departments.AddRange(
                new Department { address = "7432 Foster Street", name = "Design" },
                new Department { address = "63 Middle River Lane", name = "Development" },
                new Department { address = "Eden Prairie, MN 55347", name = "Human Resources" }
            );

            if (_context.Employees.Any())
            {
                return;
            }

            _context.Employees.AddRange(
                new Employee { departmentId = 1, firstName = "Colby", lastName = "Crosby", jobTitle = "UI/UX Designer", address = "1 Berkshire Ave. Forney, TX 75126" },
                new Employee { departmentId = 2, firstName = "Paul", lastName = "Barker", jobTitle = "Tech Lead", address = "1 Center Street New Bern, NC 28560" },
                new Employee { departmentId = 2, firstName = "Cristina", lastName = "Moses", jobTitle = ".Net Senior Developer", address = "594 Iroquois Court Bridgeton, NJ 08302" },
                new Employee { departmentId = 3, firstName = "Hadley", lastName = "Stephenson", jobTitle = "HR Representative", address = "8672 Liberty Drive Antioch, TN 37013" }
            );

            _context.SaveChanges();
        }
コード例 #2
0
 public EmployeeRepository(VogCodeChallengeDbContext context) : base(context)
 {
 }
コード例 #3
0
 public BaseRepository(VogCodeChallengeDbContext dbContext)
 {
     _dbContext = dbContext;
     DbSet      = _dbContext.Set <T>();
 }
コード例 #4
0
 public DepartmentRepository(VogCodeChallengeDbContext context) : base(context)
 {
 }