public DataContext() { Products = new List <MyProduct>(); Categories = new List <MyCategory>(); Vendors = new List <MyVendor>(); // Sample Data MyVendor v1 = new MyVendor(); v1.name = "Vendor1"; MyVendor v2 = new MyVendor(); v2.name = "Vendor2"; MyVendor v3 = new MyVendor(); v3.name = "Vendor3"; Vendors.Add(v1); Vendors.Add(v2); Vendors.Add(v3); MyCategory c1 = new MyCategory(); c1.name = "Category1"; MyCategory c2 = new MyCategory(); c2.name = "Category2"; MyCategory c3 = new MyCategory(); c3.name = "Category3"; Categories.Add(c1); Categories.Add(c2); Categories.Add(c3); MyProduct p1 = new MyProduct { name = "Product1", vendor = v1, category = c1, prize = 20.12 }; MyProduct p2 = new MyProduct { name = "Product2", vendor = v2, category = c1, prize = 1.59 }; MyProduct p3 = new MyProduct { name = "Product3", vendor = v2, category = c2, prize = 51.21 }; MyProduct p4 = new MyProduct { name = "Product4", vendor = v3, category = c1, prize = 0.99 }; MyProduct p5 = new MyProduct { name = "Product5", vendor = v3, category = c3, prize = 100.55 }; Products.Add(p1); Products.Add(p2); Products.Add(p3); Products.Add(p4); Products.Add(p5); }
private void fill() { MyCategory category1 = new MyCategory(); category1.Name = "Clothing"; MyCategory category2 = new MyCategory(); category2.Name = "Tools"; MyVendor vendor1 = new MyVendor(); vendor1.Name = "Nike"; MyVendor vendor2 = new MyVendor(); vendor2.Name = "Castorama"; MyVendor vendor3 = new MyVendor(); vendor3.Name = "Decathlon"; MyProduct product1 = new MyProduct(); product1.Name = "Hammer"; product1.Category = category2; product1.Vendor = vendor2; MyProduct product2 = new MyProduct(); product2.Name = "T-shirt"; product2.Category = category1; product2.Vendor = vendor1; MyProduct product3 = new MyProduct(); product3.Name = "Screwdriver"; product3.Category = category2; product3.Vendor = vendor2; MyProduct product4 = new MyProduct(); product4.Name = "Shoes"; product4.Category = category1; product4.Vendor = vendor3; MyProduct product5 = new MyProduct(); product5.Name = "Trousers"; product5.Category = category1; product5.Vendor = vendor2; Categories.Add(category1); Categories.Add(category2); Vendors.Add(vendor1); Vendors.Add(vendor2); Vendors.Add(vendor3); Products.Add(product1); Products.Add(product2); Products.Add(product3); Products.Add(product4); Products.Add(product5); }