Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
 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);
     }
 }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
 public void RemoveDrink(Drink drink)
 {
     var drinkToRemove = _menuDrinks.Where(x => x.Value == drink).FirstOrDefault();
     _menuDrinks.Remove(drinkToRemove);
 }
Ejemplo n.º 5
0
 public DrinkBuilder()
 {
     drink = new Drink();
 }