public async Task UpdateProductQuantity(int id, int value, bool increase) { if (increase) { await myProductDataAdapter.IncreaseProductQuantity(id, value); return; } await myProductDataAdapter.DereaseProductQuantity(id, value); }
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); } }