Пример #1
0
 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;
 }
Пример #3
0
 public DatingRepository(ApplicationDataContext Context)
 {
     _appContext = Context;
 }