public IEnumerable <PickableInventoryItem> Get(InventoryOrderEnum pickingContext, string contextKey,
                                                       ProductTypeEnum?productType = null, ProductTypeEnum?inventoryType = null, string lotKey = null, LotTypeEnum?lotType = null, LotHoldType?holdType = null, string ingredientType = null, string productKey = null, string packagingProductKey = null, string warehouseLocationKey = null, string treatmentKey = null, string productSubType = null, string locationGroupName = null,
                                                       int pageSize = 50, int skipCount = 0)
        {
            var service              = InventoryPickingServiceFactory.ResolveComponent(pickingContext);
            var filterParameters     = InventoryPickingFilterParametersHelper.ParseFilterParameters(pickingContext, ActionContext);
            var inventoryOrderResult = service.GetPickableInventoryForContext(filterParameters);

            inventoryOrderResult.EnsureSuccessWithHttpResponseException();

            var filterBySubType = !string.IsNullOrWhiteSpace(productSubType);
            var result          = inventoryOrderResult.ResultingObject
                                  .Items
                                  .Where(i => filterBySubType == false || i.LotProduct.ProductSubType == productSubType)
                                  .OrderBy(i => i.Location.Description)
                                  .PageResults(pageSize, skipCount)
                                  .Project(i =>
            {
                if (inventoryOrderResult.ResultingObject.Initializer != null)
                {
                    inventoryOrderResult.ResultingObject.Initializer.Initialize(i);
                }
            })
                                  .To <PickableInventoryItem>();

            return(result);
        }
        // POST api/{pickedInventoryContext}/{contextKey}/pickedInventory
        // POST api/movements/2013-01-01/pickedInventory
        public async Task Post(InventoryOrderEnum pickedInventoryContext, string contextKey, [FromBody] PickedInventoryDto value)
        {
            var service            = InventoryPickingServiceFactory.ResolveComponent(pickedInventoryContext);
            var setPickedInventory = value.Map().To <SetPickedInventoryParameters>();

            _identityProvider.SetUserIdentity(setPickedInventory);

            var result = await Task.Run(() => service.SetPickedInventory(contextKey, setPickedInventory));

            result.EnsureSuccessWithHttpResponseException(HttpVerbs.Put);
        }
        public async Task Post(InventoryOrderEnum pickingContext, string contextKey, [FromBody] IEnumerable <PickedInventoryItemDto> value)
        {
            var service = InventoryPickingServiceFactory.ResolveComponent(pickingContext);
            var pickedItemParameters = new SetPickedInventoryParameters
            {
                PickedInventoryItems = value.Project().To <SetPickedInventoryItemParameters>()
            };

            _identityProvider.SetUserIdentity(pickedItemParameters);

            var result = await Task.Run(() => service.SetPickedInventory(contextKey, pickedItemParameters));

            result.EnsureSuccessWithHttpResponseException(HttpVerbs.Put);
        }