Example #1
0
        public static void Initialize(TeaContext context)
        {
            context.Database.EnsureCreated();

            if (context.Users.Any())
            {
                return;   // DB has been seeded
            }
            context.Users.Add(User.CreateLocalDevUser());
            context.SaveChanges();
        }
Example #2
0
        public static void Initialize(TeaContext context, IPasswordHasher passwordHasher)
        {
            context.Database.EnsureCreated();

            if (context.Users.Any())
            {
                return;   // DB has been seeded
            }
            if (passwordHasher != null)
            {
                context.Users.Add(User.CreateLocalDevUser(passwordHasher));
                context.SaveChanges();
            }
        }
Example #3
0
        public static void Initialize(TeaContext context, IPasswordHasher passwordHasher)
        {
            context.Database.EnsureCreated();

            if (!context.Users.Any()) //LPN only do this in test and dev
            {
                if (passwordHasher != null)
                {
                    context.Users.Add(User.CreateLocalDevUser(passwordHasher));
                    context.SaveChanges();
                }
            }

            //create the default drink set
            if (!context.Drink.Any())
            {
                context.Drink.AddRange(Drink.DefaultDrinks());
                context.SaveChanges();
            }
        }