コード例 #1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new ControlAttendanceContext(
                       serviceProvider.GetRequiredService
                       <DbContextOptions <ControlAttendanceContext> >()))
            {
                if (context.Employee.Any())
                {
                    return;
                }

                context.Employee.AddRange(
                    new Employee
                {
                    Id           = 0,
                    Name         = "Felipe Bruno Silva",
                    Anniversary  = DateTime.Parse("1989-2-12"),
                    Email        = "*****@*****.**",
                    CPF          = "140.786.139-66",
                    NumberPhone  = 992213132,
                    Salary       = 1039,
                    AnyAddress   = "Avenida babel",
                    NumberAdress = 69,
                    City         = "Uberlândia",
                    District     = "Canaã"
                });

                context.SaveChanges();
            }
        }
コード例 #2
0
 public EmployeesController(ControlAttendanceContext context)
 {
     _context = context;
 }