Beispiel #1
0
        public static void SeedUsers(DatingContext context)
        {
            if (!context.Users.Any())
            {
                var usersData = System.IO.File.ReadAllText("Data/UsersSeedData.json");
                var users     = JsonConvert.DeserializeObject <List <Users> >(usersData);
                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();
            }
        }
Beispiel #2
0
 public Seed(DatingContext context)
 {
     _context = context;
 }
Beispiel #3
0
 public DatingRepository(DatingContext context)
 {
     _context = context;
 }
Beispiel #4
0
 public AuthRepository(DatingContext context)
 {
     _context = context;
 }