public async Task InitializeData() { //_dbContext.Database.EnsureDeleted(); if (_dbContext.Database.EnsureCreated()) { //seeding the database with metingen, see DBContext User user1 = new User { Email = "*****@*****.**", FirstName = "Adam", LastName = "Master" }; user1.AddMeting(new Meting { Created = DateTime.Now, User = user1, MetingResultaat = 25 }); //meting van account _dbContext.users.Add(user1); await CreateUser(user1.Email, "P@ssword1111"); User user2 = new User { Email = "*****@*****.**", FirstName = "Student", LastName = "Hogent" }; user2.AddMeting(new Meting { User = user2, MetingResultaat = -5 }); //meting van account user2.AddMeting(new Meting { User = user2, MetingResultaat = 55 }); //meting van account _dbContext.users.Add(user2); await CreateUser(user2.Email, "P@ssword1111"); _dbContext.SaveChanges(); } }
public async Task InitializeData() { _dbContext.Database.EnsureDeleted(); if (_dbContext.Database.EnsureCreated()) { //seeding the database with metingen, see DBContext User user1 = new User { Email = "*****@*****.**", FirstName = "Adam", LastName = "Master" }; _dbContext.users.Add(user1); await CreateUser(user1.Email, "P@ssword1111"); User user2 = new User { Email = "*****@*****.**", FirstName = "Student", LastName = "Hogent" }; _dbContext.users.Add(user2); await CreateUser(user2.Email, "P@ssword1111"); _dbContext.SaveChanges(); } }