Example #1
0
        public static void SeedUsers(Datacontext context)
        {
            if (!context.Users.Any())
            {
                var userData = System.IO.File.ReadAllText("Data/UserSeedData.json");
                var users    = JsonConvert.DeserializeObject <List <User> >(userData);
                foreach (var user in users)
                {
                    byte[] passwordHash, passwordSalt;
                    CreatePasswordHash("password", out passwordHash, out passwordSalt);

                    user.PasswordHash = passwordHash;
                    user.PasswordSalt = passwordSalt;
                    user.UserName     = user.UserName.ToLower();
                    context.Users.Add(user);
                }
            }

            context.SaveChanges();
        }
Example #2
0
 public AuthRepository(Datacontext context)
 {
     _context = context;
 }
 public BasketballRepository(Datacontext context)
 {
     _context = context;
 }