/// <summary> /// Create product start-up stock mappings for all restaurants /// </summary> public void SetDefaultStockList() { //Get all restaurants from data source var restaurants = _restaurantService.Get(new GetRestaurantRequest()).Restaurants; var restaurantCount = restaurants.Count; //Get all products from data source var products = _productService.Get(new GetProductsRequest()).Products; var productsCount = products.Count; //For each restaurant Parallel.ForEach(restaurants, restaurant => { //For each products Parallel.ForEach(products, product => { _supplyService.CreateRestaurantProductMappings(new CreateRestaurantProductMappingRequest { RestaurantID = restaurant.ID, ProductID = product.ID, ExpectedStockAmount = RandomHelper.RandomDouble(Constants.ExpectedStockAmount.Min, Constants.ExpectedStockAmount.Max) }); }); }); }