Advertisement
Guest User

Untitled

a guest
Feb 10th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. public static void PopulateCustomers(IApplicationBuilder app)
  2. {
  3. CustomerDbContext context = app.ApplicationServices.GetRequiredService<CustomerDbContext>();
  4. if (!context.Customers.Any())
  5. {
  6. context.Customers.AddRange(
  7. new List<Customer>
  8. {
  9. new Customer { CustomerName = "Tintin", Email = "tintin@t.com", Mobile = "123456789" },
  10. new Customer { CustomerName = "Snowy", Email = "snowy@s.com", Mobile = "234567890" },
  11. new Customer { CustomerName = "Hadhock", Email = "hadhock@h.com", Mobile = "3456789012" },
  12. new Customer { CustomerName = "Jughead", Email = "jughead@j.com", Mobile = "4567890123" },
  13. new Customer { CustomerName = "Archie", Email = "archie@a.com", Mobile = "5678901234" },
  14. new Customer { CustomerName = "Phantom", Email = "phantom@p.com", Mobile = "6747890123" },
  15. new Customer { CustomerName = "Mandrake", Email = "mandrake@m.com", Mobile = "7647890123" },
  16. new Customer { CustomerName = "Betty", Email = "betty@b.com", Mobile = "8847890123" },
  17. new Customer { CustomerName = "Baloo", Email = "baloo@b.com", Mobile = "9947890123" },
  18. new Customer { CustomerName = "Mowgli", Email = "mowgli@m.com", Mobile = "1047890123" }
  19. });
  20. context.SaveChanges();
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement