private void RemoveStockListItem(Item item)
        {
            var matchedItem = SalesSearchResults.FirstOrDefault(x => x.InventoryModel.InventoryId == item.InventoryModel.InventoryId);
            var itemIndex   = SalesSearchResults.IndexOf(matchedItem);

            SalesSearchResults[itemIndex].InventoryModel.Quantity -= item.InventoryModel.Quantity;

            SalesSearchResults = new ObservableCollection <Item>(SalesSearchResults);
        }
        private async void UpdateSalesItemsSearchResult()
        {
            if (SalesSearchResults != null)
            {
                var itemIds = SalesSearchResults.Select(x => x.InventoryModel.ItemId);

                var output = await _inventoryProcessor.GetInventoryItemsById(itemIds);

                LoadSalesItemsSearchResults(output);
            }
        }
        private void ExecuteShoppingListCancelCommand()
        {
            var currentShoppingList = ShoppingList.ToList();

            foreach (var item in currentShoppingList)
            {
                var matchedItem      = SalesSearchResults.FirstOrDefault(x => x.InventoryModel.InventoryId == item.InventoryModel.InventoryId);
                var matchedItemIndex = SalesSearchResults.IndexOf(matchedItem);
                SalesSearchResults[matchedItemIndex].InventoryModel.Quantity += item.InventoryModel.Quantity;
            }

            SalesSearchResults = new ObservableCollection <Item>(SalesSearchResults);

            ShoppingList.Clear();
            CalculateTotalPrice();
        }
        private async void ExecuteShoppingListConfirmCommand()
        {
            var currentShoppingList = ShoppingList.ToList();

            int resultsChanged = 0;

            foreach (var item in currentShoppingList)
            {
                var inventoryId = item.InventoryModel.InventoryId;

                var inventoryItem = SalesSearchResults.FirstOrDefault(x => x.InventoryModel.InventoryId == inventoryId)?.InventoryModel;

                resultsChanged += await _inventoryProcessor.UpdateInventoryItem(inventoryItem);
            }

            if (currentShoppingList.Count != resultsChanged)
            {
                throw new Exception("Error updating one or more of the items in inventory.");
            }

            ShoppingList.Clear();
            CalculateTotalPrice();
            UpdateItemsSearchResults();
        }