예제 #1
0
        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();
        }
예제 #2
0
 public void Commit()
 {
     _dbContext.SaveChanges();
 }