コード例 #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();
            }
        }
コード例 #2
0
 public AuthService(DataContext2 context)
 {
     _context = context;
 }
コード例 #3
0
 public DatingRepository(DataContext2 context)
 {
     _context = context;
 }