public void Seed() { var listBrands = new List <Brand> { new Brand { Name = "Fiat" }, new Brand { Name = "Chevrolet" }, new Brand { Name = "Wolkswagem" }, new Brand { Name = "Kia" }, new Brand { Name = "Renault" }, new Brand { Name = "Toyota" } }; if (_dbContext.Set <Brand>().Any()) { return; } _dbContext.AddRange(listBrands); _dbContext.SaveChanges(); }
public void Commit() { _dbContext.SaveChanges(); }