Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void PopulateCustomers(IApplicationBuilder app)
- {
- CustomerDbContext context = app.ApplicationServices.GetRequiredService<CustomerDbContext>();
- if (!context.Customers.Any())
- {
- context.Customers.AddRange(
- new List<Customer>
- {
- new Customer { CustomerName = "Tintin", Email = "tintin@t.com", Mobile = "123456789" },
- new Customer { CustomerName = "Snowy", Email = "snowy@s.com", Mobile = "234567890" },
- new Customer { CustomerName = "Hadhock", Email = "hadhock@h.com", Mobile = "3456789012" },
- new Customer { CustomerName = "Jughead", Email = "jughead@j.com", Mobile = "4567890123" },
- new Customer { CustomerName = "Archie", Email = "archie@a.com", Mobile = "5678901234" },
- new Customer { CustomerName = "Phantom", Email = "phantom@p.com", Mobile = "6747890123" },
- new Customer { CustomerName = "Mandrake", Email = "mandrake@m.com", Mobile = "7647890123" },
- new Customer { CustomerName = "Betty", Email = "betty@b.com", Mobile = "8847890123" },
- new Customer { CustomerName = "Baloo", Email = "baloo@b.com", Mobile = "9947890123" },
- new Customer { CustomerName = "Mowgli", Email = "mowgli@m.com", Mobile = "1047890123" }
- });
- context.SaveChanges();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement