Exemplo n.º 1
0
        public string AddDrink(string type, string name, int servingSize, string brand)
        {
            var drink = drinkFactory.CreateDrink(type, name, servingSize, brand);

            this.drinks.Add(drink);
            return($"Added {name} ({brand}) to the drink pool");
        }
        public string AddDrink(string type, string name, int servingSize, string brand)
        {
            IDrink drink = drinkFactory.CreateDrink(type, name, servingSize, brand);

            this.drinks.Add(drink);

            return(string.Format(Messages.SuccessfulyAddedDrink, drink.Name, drink.Brand));
        }
Exemplo n.º 3
0
        public string AddDrink(string type, string name, int servingSize, string brand)
        {
            var    drink  = drinkFactory.CreateDrink(type, name, servingSize, brand);
            string result = string.Empty;

            if (drink != null)
            {
                this.drinks.Add(drink);
                result = $"Added {drink.Name} ({drink.Brand}) to the drink pool";
            }

            return(result);
        }
Exemplo n.º 4
0
        public string AddDrink(string type, string name, int servingSize, string brand)
        {
            var drinkFactory = new DrinkFactory();

            try
            {
                var drink   = drinkFactory.CreateDrink(type, name, servingSize, brand);
                var message = $"Added {drink.Name} ({drink.Brand}) to the drink pool";
                this.Drinks.Add(drink);
                return(message);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }