public Franchisee(MagicMVCContext context, string userID = "", int storeID = 1) { _context = context; this.UserID = userID; this.StoreID = storeID; }
public Owner(MagicMVCContext context) { _context = context; }
public Customer(MagicMVCContext context) { _context = context; }
public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MagicMVCContext( serviceProvider.GetRequiredService <DbContextOptions <MagicMVCContext> >())) { // Look for any products. if (context.Products.Any()) { return; // DB has been seeded. } var products = new[] { new Product { Name = "Rabbit" }, new Product { Name = "Hat" }, new Product { Name = "Svengali Deck" }, new Product { Name = "Floating Hankerchief" }, new Product { Name = "Wand" }, new Product { Name = "Broomstick" }, new Product { Name = "Bang Gun" }, new Product { Name = "Cloak of Invisibility" }, new Product { Name = "Elder Wand" }, new Product { Name = "Resurrection Stone" } }; context.Products.AddRange(products); var i = 0; context.OwnerInventory.AddRange( new OwnerInventory { Product = products[i++], StockLevel = 20 }, new OwnerInventory { Product = products[i++], StockLevel = 50 }, new OwnerInventory { Product = products[i++], StockLevel = 100 }, new OwnerInventory { Product = products[i++], StockLevel = 150 }, new OwnerInventory { Product = products[i++], StockLevel = 40 }, new OwnerInventory { Product = products[i++], StockLevel = 10 }, new OwnerInventory { Product = products[i++], StockLevel = 5 }, new OwnerInventory { Product = products[i++], StockLevel = 0 }, new OwnerInventory { Product = products[i++], StockLevel = 0 }, new OwnerInventory { Product = products[i], StockLevel = 0 } ); i = 0; var stores = new[] { new Store { Name = "Melbourne CBD", //StoreID = 0, StoreInventoryList = { new StoreInventory { Product = products[i++], StockLevel = 15 }, new StoreInventory { Product = products[i++], StockLevel = 10 }, new StoreInventory { Product = products[i++], StockLevel = 5 }, new StoreInventory { Product = products[i++], StockLevel = 5 }, new StoreInventory { Product = products[i++], StockLevel = 5 }, new StoreInventory { Product = products[i++], StockLevel = 5 }, new StoreInventory { Product = products[i++], StockLevel = 5 }, new StoreInventory { Product = products[i++], StockLevel = 1 }, new StoreInventory { Product = products[i++], StockLevel = 1 }, new StoreInventory { Product = products[i], StockLevel = 1 }, } }, new Store { Name = "North Melbourne", //StoreID = 1, StoreInventoryList = { new StoreInventory { Product = products[0], StockLevel = 5 } } }, new Store { Name = "East Melbourne", //StoreID = 2, StoreInventoryList = { new StoreInventory { Product = products[1], StockLevel = 5 } } }, new Store { Name = "South Melbourne", //StoreID = 3, StoreInventoryList = { new StoreInventory { Product = products[2], StockLevel = 5 } } }, new Store { Name = "West Melbourne", //StoreID = 4, } }; context.Stores.AddRange(stores); context.SaveChanges(); } }