Exemple #1
0
        public static void SeedUsers(DContext 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();
            }
        }
Exemple #2
0
 public DataRepository(DContext context)
 {
     _context = context;
 }
Exemple #3
0
 public AuthRepository(DContext context)
 {
     _context = context;
 }