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(); } }
public DataRepository(DContext context) { _context = context; }
public AuthRepository(DContext context) { _context = context; }