Exemple #1
0
        public static void SeedUsers(DataContex context)
        {
            // if there are no users we will create some
            if (!context.Users.Any())
            {
                var userData = System.IO.File.ReadAllText("DataAccess/UserSeedData.json");
                var users    = JsonConvert.DeserializeObject <List <User> >(userData);

                // add the users in the seed json to the db
                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);
                }

                // saves the users into the db
                context.SaveChanges();
            }
        }
 public DatingRepository(DataContex contex)
 {
     _contex = contex;
 }
Exemple #3
0
 public AuthRepository(DataContex context)
 {
     _context = context;
 }