public async Task <ActionResult> DeleteFilteredAssignments([FromQuery] PricelistAssignmentsSearchCriteria criteria)
        {
            if (criteria == null)
            {
                criteria = new PricelistAssignmentsSearchCriteria();
            }

            var result = await _pricingSearchService.SearchPricelistAssignmentsAsync(criteria);

            var                  pricelistAssignmentsIds = result.Results.Select(x => x.Id);
            const int            BATCH_SIZE = 20;
            var                  skip       = 0;
            IEnumerable <string> batch;

            while ((batch = pricelistAssignmentsIds.Skip(skip).Take(BATCH_SIZE)).Count() > 0)
            {
                await _pricingService.DeletePricelistsAssignmentsAsync(batch.ToArray());

                skip += BATCH_SIZE;
            }

            return(NoContent());
        }
示例#2
0
        public async Task <IActionResult> DeleteAssignments(string[] ids)
        {
            await _pricingService.DeletePricelistsAssignmentsAsync(ids);

            return(NoContent());
        }