private void InitializeProducts()
 {
     // Create a list of 500 products. 250 are in the Shoes category, 125 in the Electronics 
     // category and 125 in the Food category.
     for (int i = 0; i < 500; i++)
     {
         var product = new Product();
         product.Name = "Product " + (i + 1);
         product.Category = "All products";
         allProducts.Add(product);
     }
 }
 private void InitializeProducts()
 {
     // Create a list of products. 50% of them are in the Shoes category, 25% in the Electronics 
     // category and 25% in the Food category.
     for (var i = 0; i < 527; i++)
     {
         var product = new Product();
         product.Name = "Product " + (i + 1);
         var categoryIndex = i % 4;
         if (categoryIndex > 2)
         {
             categoryIndex = categoryIndex - 3;
         }
         product.Category = allCategories[categoryIndex];
         allProducts.Add(product);
     }
 }
Beispiel #3
0
 private void InitializeProducts()
 {
     // Create a list of 500 products. 250 are in the Shoes category, 125 in the Electronics
     // category and 125 in the Food category.
     for (int i = 0; i < 500; i++)
     {
         var product = new Product();
         product.Name = "Product " + (i + 1);
         int categoryIndex = i%4;
         if (categoryIndex > 2)
         {
             categoryIndex = categoryIndex - 3;
         }
         product.Category = categories[categoryIndex];
         allProducts.Add(product);
     }
 }