Esempio n. 1
0
        public static Drink Get_Drink(string drinkName)
        {
            Drinks.InitialiseDrinks();
            Drink drink = _Drinks.FirstOrDefault(x => x.Name.ToLower() == drinkName.ToLower());

            return(drink);
        }
Esempio n. 2
0
        public static bool Update_DrinkQuantity(string drinkName, int increase)
        {
            Drinks.InitialiseDrinks();

            Drink drink = _Drinks.FirstOrDefault(x => x.Name.ToLower() == drinkName.ToLower());

            if (drink == null)
            {
                return(false);
            }

            drink.Quantity += increase;
            return(true);
        }
Esempio n. 3
0
        public static bool Delete_Drink(string drinkName)
        {
            Drinks.InitialiseDrinks();

            Drink drink = _Drinks.FirstOrDefault(x => x.Name.ToLower() == drinkName.ToLower());

            if (drink == null)
            {
                return(false);
            }

            _Drinks.Remove(drink);
            return(true);
        }
Esempio n. 4
0
        public static bool Add_Drink(string drinkName, int qty)
        {
            Drinks.InitialiseDrinks();

            if (_Drinks.Any(x => x.Name.ToLower() == drinkName.ToLower()))
            {
                return(Update_DrinkQuantity(drinkName, qty));
            }

            Drink newDrink = new Drink()
            {
                Name     = drinkName,
                Quantity = qty
            };

            _Drinks.Add(newDrink);

            return(true);
        }
Esempio n. 5
0
 public static List <Drink> Get_AllDrinks()
 {
     Drinks.InitialiseDrinks();
     return(_Drinks);
 }