Esempio n. 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new JewelryStoreContext(serviceProvider.GetRequiredService <DbContextOptions <JewelryStoreContext> >()))
            {
                if (context.User.Any())
                {
                    return;
                }

                context.User.AddRange(
                    new User
                {
                    //Id = 1,
                    FirstName    = "Arunkumar",
                    LastName     = "B",
                    UserName     = "******",
                    Password     = "******",
                    IsPrevilaged = true
                },
                    new User
                {
                    //Id = 2,
                    FirstName    = "Kiran",
                    LastName     = "B",
                    UserName     = "******",
                    Password     = "******",
                    IsPrevilaged = false
                }

                    );

                context.SaveChanges();
            }
        }
 public LoginController(JewelryStoreContext context)
 {
     _context = context;
 }