示例#1
0
        public static void Initialize(ToyAppContext context)
        {
            if (!context.Employees.Any())
            {
                var emp1 = new Employee
                {
                    FullName       = "Moamen Mohamed",
                    Email          = "*****@*****.**",
                    EmployeeSkills = new List <EmployeeSkill> {
                        new EmployeeSkill {
                            SkillId = 1
                        },
                        new EmployeeSkill {
                            SkillId = 2
                        },
                        new EmployeeSkill {
                            SkillId = 4
                        }
                    }
                };

                var emp2 = new Employee
                {
                    FullName = "Moamed Essam",
                };

                context.Add(emp1);
                context.Add(emp2);

                context.SaveChanges();
            }
        }
 public EmployeeRepository(ToyAppContext context)
 {
     _context = context;
 }
 public SkillRepository(ToyAppContext context)
 {
     _context = context;
 }