Ejemplo n.º 1
0
 public void AddFridgeItem(FridgeItem item)
 {
     try
     {
         var foodProducts = _fridgeItems.Select(x => x.FoodProductId).ToList();
         if (foodProducts.Contains(item.FoodProductId))
         {
             _fridgeItems
             .Where(x => x.FoodProductId == item.FoodProductId)
             .First()
             .IncreaseFridgeItemAmount(item.AmountValue);
         }
         else
         {
             _fridgeItems.Add(item);
         }
     }
     catch
     {
         throw new AppException("Cant add FridgeItem for this user.", "AddFridgeItemFailed");
     }
 }
Ejemplo n.º 2
0
 private void ConsumeFridgeItem(FridgeItem item, AmountValue amountValue)
 {
     item.ConsumeFridgeItem(amountValue);
 }