Пример #1
0
        public async Task UpdateProductQuantity(int id, int value, bool increase)
        {
            if (increase)
            {
                await myProductDataAdapter.IncreaseProductQuantity(id, value);

                return;
            }
            await myProductDataAdapter.DereaseProductQuantity(id, value);
        }
Пример #2
0
        public void AddQuantityToProductForCheckedItems(Guid shoppingListId)
        {
            var checkedItems = myShoppingListDataAdapter.GetItemsForShoppingList(shoppingListId).Where(i => i.IsChecked);


            foreach (var item in checkedItems)
            {
                List <MeasurementForShopItemModel> checkedMeasurements = myShoppingListDataAdapter.GetMeasurementsForCheckedItem(item.Id);
                checkedMeasurements.ForEach(m => myProductDataAdapter.IncreaseProductQuantity(m.Measurement.ProductQuantityId, m.Count));

                myShoppingListDataAdapter.RemoveProductFromShoppingList(item.Id);
            }
        }