public ApiController(ApidbContext context) { _context = context; if (_context.CustomerList.Count() == 0) { _context.CustomerList.Add(new CustomerModel { Name = "Customer 1", saleIdList = "" }); _context.CustomerList.Add(new CustomerModel { Name = "Customer 2", saleIdList = "" }); _context.CustomerList.Add(new CustomerModel { Name = "Customer 3", saleIdList = "" }); _context.CustomerList.Add(new CustomerModel { Name = "Customer 4", saleIdList = "" }); _context.CustomerList.Add(new CustomerModel { Name = "Customer 5", saleIdList = "" }); _context.SaveChanges(); } if (_context.SalesList.Count() == 0) { // Create a new SalesList if collection is empty _context.SalesList.Add(new SalesRepModel { FirstName = "Sale Rep1", LastName = "Sales1", custIdList = "" }); _context.SalesList.Add(new SalesRepModel { FirstName = "Sale Rep2", LastName = "Sales2", custIdList = "" }); _context.SalesList.Add(new SalesRepModel { FirstName = "Sale Rep3", LastName = "Sales3", custIdList = "" }); _context.SalesList.Add(new SalesRepModel { FirstName = "Sale Rep4", LastName = "Sale4", custIdList = "" }); _context.SaveChanges(); } }
public void Seed(ApidbContext _context) { if (_context.ProductItems.Count() == 0) { _context.ProductItems.Add(new Model.Product { Id = 1, Name = "Apple Juice", Description = "Juice made of fresh apple" }); _context.ProductItems.Add(new Model.Product { Id = 2, Name = "Orange Juice", Description = "Juice made of fresh Oranges" }); _context.ProductItems.Add(new Model.Product { Id = 3, Name = "Grape Juice", Description = "Juice made of fresh Grape" }); _context.ProductItems.Add(new Model.Product { Id = 4, Name = "Banana Juice", Description = "Juice made of fresh Banana" }); _context.ProductItems.Add(new Model.Product { Id = 5, Name = "Lemom Juice", Description = "Juice made of fresh Lemom" }); _context.ProductItems.Add(new Model.Product { Id = 6, Name = "Pineapple Juice", Description = "Juice made of fresh Pineapple" }); _context.ProductItems.Add(new Model.Product { Id = 7, Name = "Tea", Description = "Hot Masala Tea" }); _context.ProductItems.Add(new Model.Product { Id = 8, Name = "Coffee", Description = "Hot coffee with original coffee beans" }); _context.ProductItems.Add(new Model.Product { Id = 9, Name = "Cold Coffee", Description = "Icy cold coffee" }); _context.ProductItems.Add(new Model.Product { Id = 10, Name = "Coffee latte", Description = "Hot coffee Latte" }); _context.ProductItems.Add(new Model.Product { Id = 11, Name = "Ice cream", Description = "Chocolate Ice cream" }); _context.ProductItems.Add(new Model.Product { Id = 12, Name = "Chips", Description = "Cream and Onion Chips" }); _context.ProductItems.Add(new Model.Product { Id = 13, Name = "Apple Juice", Description = "Juice made of fresh apple" }); _context.ProductItems.Add(new Model.Product { Id = 14, Name = "Apple Juice", Description = "Juice made of fresh apple" }); _context.ProductItems.Add(new Model.Product { Id = 15, Name = "Apple Juice", Description = "Juice made of fresh apple" }); _context.ProductItems.Add(new Model.Product { Id = 16, Name = "Apple Juice", Description = "Juice made of fresh apple" }); _context.ProductItems.Add(new Model.Product { Id = 17, Name = "Apple Juice", Description = "Juice made of fresh apple" }); _context.ProductItems.Add(new Model.Product { Id = 18, Name = "Apple Juice", Description = "Juice made of fresh apple" }); _context.ProductItems.Add(new Model.Product { Id = 19, Name = "Apple Juice", Description = "Juice made of fresh apple" }); _context.SaveChanges(); } }