public async Task EnsureSeedData() { _context.Database.EnsureCreated(); _context.Customers.RemoveRange(_context.Customers); _context.SaveChanges(); Customer customer = new Customer(); customer.Firstname = "Chuck"; customer.Lastname = "Norris"; customer.Age = 30; customer.Id = Guid.NewGuid(); _context.Add(customer); Customer customer2 = new Customer(); customer2.Firstname = "Dave"; customer2.Lastname = "Arnoldi"; customer2.Age = 47; customer2.Id = Guid.NewGuid(); _context.Add(customer2); await _context.SaveChangesAsync(); }
public async Task EnsureSeedData() { _context.Database.EnsureCreated(); _context.Customers.RemoveRange(_context.Customers); _context.SaveChanges(); Customer customer = new Customer(); customer.Firstname = "Chuck"; customer.Lastname = "Norris"; customer.Age = 30; customer.Id = Guid.NewGuid(); _context.Add(customer); Customer customer2 = new Customer(); customer2.Firstname = "Fabian"; customer2.Lastname = "Gosebrink"; customer2.Age = 31; customer2.Id = Guid.NewGuid(); Customer customer3 = new Customer(); customer3.Firstname = "Damien"; customer3.Lastname = "Bowden"; customer3.Age = 32; customer3.Id = Guid.NewGuid(); Customer customer4 = new Customer(); customer4.Firstname = "Obi-Wan"; customer4.Lastname = "Kenobi"; customer4.Age = 33; customer4.Id = Guid.NewGuid(); Customer customer5 = new Customer(); customer5.Firstname = "Phil"; customer5.Lastname = "Collins"; customer5.Age = 34; customer5.Id = Guid.NewGuid(); Customer customer6 = new Customer(); customer6.Firstname = "Robert"; customer6.Lastname = "Plant"; customer6.Age = 69; customer6.Id = Guid.NewGuid(); _context.Add(customer2); _context.Add(customer3); _context.Add(customer4); _context.Add(customer5); _context.Add(customer6); await _context.SaveChangesAsync(); }
public async Task EnsureSeedData() { _context.Database.EnsureCreated(); _context.Customers.RemoveRange(_context.Customers); _context.SaveChanges(); Customer customer = new Customer(); customer.Firstname = "Chuck"; customer.Lastname = "Norris"; customer.Age = 30; customer.Id = Guid.NewGuid(); _context.Add(customer); Customer customer2 = new Customer(); customer2.Firstname = "Fabian"; customer2.Lastname = "Gosebrink"; customer2.Age = 31; customer2.Id = Guid.NewGuid(); _context.Add(customer2); Customer customer3 = new Customer(); customer3.Firstname = "Abhilash"; customer3.Lastname = "Narayan"; customer3.Age = 30; customer3.Id = Guid.NewGuid(); _context.Add(customer3); await _context.SaveChangesAsync(); }
public async Task EnsureSeedData() { _context.Database.EnsureCreated(); _context.Customers.RemoveRange(_context.Customers); _context.SaveChanges(); Customer customer = new Customer(); customer.FirstName = "Jan"; customer.LastName = "Peeters"; customer.Age = 32; customer.Id = Guid.NewGuid(); _context.Add(customer); Customer customer2 = new Customer(); customer2.FirstName = "Ludo"; customer2.LastName = "Janssens"; customer2.Age = 40; customer2.Id = Guid.NewGuid(); _context.Add(customer); await _context.SaveChangesAsync(); }
public bool Save() { return(_context.SaveChanges() >= 0); }
public async Task EnsureSeedData() { _context.Database.EnsureCreated(); _context.Customers.RemoveRange(_context.Customers); _context.SaveChanges(); Customer customer = new Customer(); customer.FirstName = "Tharana"; customer.LastName = "Mayuranga"; customer.Age = 26; customer.Id = Guid.NewGuid(); _context.Add(customer); Customer customer2 = new Customer(); customer2.FirstName = "Amila"; customer2.LastName = "Suranga"; customer2.Age = 30; customer2.Id = Guid.NewGuid(); _context.Add(customer2); Customer customer3 = new Customer(); customer3.FirstName = "Amila"; customer3.LastName = "Suranga"; customer3.Age = 30; customer3.Id = Guid.NewGuid(); _context.Add(customer3); Customer customer4 = new Customer(); customer4.FirstName = "Amila"; customer4.LastName = "Suranga"; customer4.Age = 30; customer4.Id = Guid.NewGuid(); _context.Add(customer4); Customer customer5 = new Customer(); customer5.FirstName = "Amila"; customer5.LastName = "Suranga"; customer5.Age = 30; customer5.Id = Guid.NewGuid(); _context.Add(customer5); Customer customer6 = new Customer(); customer6.FirstName = "Amila"; customer6.LastName = "Suranga"; customer6.Age = 30; customer6.Id = Guid.NewGuid(); _context.Add(customer6); await _context.SaveChangesAsync(); }