public IList<Inventory> AdjustInventory(Drink drink)
        {
            foreach (var ingredient in drink.DrinkIngredients)
            {
                _currentInventory.Where(x => x.ItemName == ingredient.IngredientName).FirstOrDefault().StockLevel -= ingredient.Unit;
            }

            return _currentInventory;
        }
 public void MakeDrink(Drink drink, IInventoryControl inventoryControl)
 {
     if(inventoryControl.CheckLevels(drink))
     {
         Console.WriteLine("\nDispensing: {0}\n", drink.DrinkName);
         inventoryControl.AdjustInventory(drink);
     }
     else {
         Console.WriteLine("\nOut of Stock: {0}\n", drink.DrinkName);
     }
 }
        public bool CheckLevels(Drink drink)
        {
            foreach (var ingredient in drink.DrinkIngredients)
            {
                var currentStockLevel = _currentInventory.Where(x => x.ItemName == ingredient.IngredientName)
                                                            .FirstOrDefault()
                                                            .StockLevel;

                if (currentStockLevel < ingredient.Unit)
                    return false;
            }

            return true;
        }
Exemple #4
0
 public void RemoveDrink(Drink drink)
 {
     var drinkToRemove = _menuDrinks.Where(x => x.Value == drink).FirstOrDefault();
     _menuDrinks.Remove(drinkToRemove);
 }
 public DrinkBuilder()
 {
     drink = new Drink();
 }