public static void SeedUsers(ApplicationDataContext 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;
             CreatePssswordHash("password", out passwordhash, out passwordSalt);
             user.PasswordHash = passwordhash;
             user.PasswordSalt = passwordSalt;
             user.UserName     = user.UserName.ToLower();
             context.Users.Add(user);
         }
         context.SaveChanges();
     }
 }
 public AuthRepository(ApplicationDataContext context)
 {
     _context = context;
 }
Exemple #3
0
 public DatingRepository(ApplicationDataContext Context)
 {
     _appContext = Context;
 }