public IHttpActionResult BatchOutdatedProducts()
        {
            var response = _contentService.Productstatuses.List(_settingsManager.MerchantId).Execute();

            var outdated = GetOutdatedProducts(response.Resources);

            if (outdated != null && outdated.Any())
            {
                var products = _productProvider.GetProductsBatchRequest(outdated);
                products.Entries.ForEach(item => item.MerchantId = _settingsManager.MerchantId);
                var res = _contentService.Products.Custombatch(products).Execute();
                return(Ok(res));
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Пример #2
0
        public IHttpActionResult BatchOutdatedProducts()
        {
            var productStatusesResponse = _contentService.Productstatuses.List(_settingsManager.MerchantId).Execute();

            var outdatedProductIds = GetOutdatedProductIds(productStatusesResponse.Resources);

            if (!outdatedProductIds.Any())
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }

            var productsUpdateRequest = _productProvider.GetProductsBatchRequest(outdatedProductIds);
            var response = PerformBatchProductsUpdate(productsUpdateRequest);

            return(Ok(response));
        }