Beispiel #1
0
        public static void SeedUsers(DataContxt 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[] passwordSalt, passwordHash;
                    CreatePasswordHash("password", out passwordHash, out passwordSalt);

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

                context.SaveChanges();
            }
        }
 public AuthRepository(DataContxt context)
 {
     _context = context;
 }
Beispiel #3
0
 public DatingRepository(DataContxt context)
 {
     _context = context;
 }