public string AddDrink(string type, string name, int servingSize, string brand)
        {
            IDrink drink = DrinkFactory.CreateDrink(type, name, servingSize, brand);

            this.drinks.Add(drink);

            return($"Added {name} ({brand}) to the drink pool");
        }
 public RestaurantController()
 {
     this.menu         = new List <IFood>();
     this.drinks       = new List <IDrink>();
     this.tables       = new List <ITable>();
     this.foodFactory  = new FoodFactory();
     this.drinkFactory = new DrinkFactory();
     this.tableFactory = new TableFactory();
 }
Exemplo n.º 3
0
        public string AddDrink(string type, string name, int servingSize, string brand)
        {
            IDrink drink = DrinkFactory.GetDrink(type, name, servingSize, brand);

            if (!(drink is null))
            {
                drinks.Add(drink);
                return($"Added {name} ({brand}) to the drink pool");
            }

            return(null);
        }
Exemplo n.º 4
0
        public string AddDrink(string type, string name, int servingSize, string brand)
        {
            IDrink drink = DrinkFactory.Create(type, name, servingSize, brand);

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

            return(string.Empty);
        }
Exemplo n.º 5
0
        public RestaurantController() //ok
        {
            this.menu   = new List <IFood>();
            this.drinks = new List <IDrink>();
            this.tables = new List <ITable>();

            //Factory
            this.foodFactory  = new FoodFactory();
            this.drinkFactory = new DrinkFactory();
            this.tableFactory = new TableFactory();
            this.income       = 0.0m;
        }
        public RestaurantController(
            DrinkFactory drinkFactory,
            FoodFactory foodFactory,
            TableFactory tableFactory)
        {
            this.menu   = new List <IFood>();
            this.drinks = new List <IDrink>();
            this.tables = new List <ITable>();

            this.drinkFactory = drinkFactory;
            this.foodFactory  = foodFactory;
            this.tableFactory = tableFactory;
        }
Exemplo n.º 7
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);
            }
        }