public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = TableFactory.CreateTable(type, tableNumber, capacity);

            this.tables.Add(table);

            return($"Added table number {tableNumber} in the restaurant");
        }
 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();
 }
예제 #3
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            ITable table = TableFactory.Create(type, tableNumber, capacity);

            if (table != null)
            {
                tables.Add(table);
                return($"Added table number {table.TableNumber} in the restaurant");
            }

            return(string.Empty);
        }
예제 #4
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;
        }
예제 #5
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            string newType = $"{type}Table";
            ITable table   = TableFactory.GetTable(newType, tableNumber, capacity);

            if (!(table is null))
            {
                tables.Add(table);
                return($"Added table number {tableNumber} in the restaurant");
            }

            return(null);
        }
        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;
        }
예제 #7
0
        public string AddTable(string type, int tableNumber, int capacity)
        {
            var tableFactory = new TableFactory();

            try
            {
                var table   = tableFactory.CreateTable(type, tableNumber, capacity);
                var message = $"Added table number {table.TableNumber} in the restaurant";
                Tables.Add(table);
                return(message);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }