Ejemplo n.º 1
0
        public static void SeedUsers(DataContext2 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.ToLower();
                    context.Users.Add(user);
                }
                context.SaveChanges();
            }
        }
 public AuthService(DataContext2 context)
 {
     _context = context;
 }
Ejemplo n.º 3
0
 public DatingRepository(DataContext2 context)
 {
     _context = context;
 }