Ejemplo n.º 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new EmpleatContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <EmpleatContext> >()))
            {
                // Look for any movies.
                if (context.Empleats.Any())
                {
                    return;   // DB has been seeded
                }

                context.Empleats.AddRange(
                    new Empleat
                {
                    Nom    = "Ismael",
                    Cognom = "Anaya",
                    Càrrec = "CTO",
                    Sou    = "40000"
                },
                    new Empleat
                {
                    Nom    = "Patricia",
                    Cognom = "Costa",
                    Càrrec = "CEO",
                    Sou    = "60000"
                }
                    );
                context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
 public Data(EmpleatContext context)
 {
     _context = context;
 }