Beispiel #1
0
        /// <summary>
        ///     Adds a new restaurant
        /// </summary>
        /// <param name="restaurant"></param>
        public void AddRestaurant(IRestaurant restaurant)
        {
            if (_restaurants.Contains(restaurant))
            {
                throw new Exception("Restaurant is already added");
            }

            _restaurants.Add(restaurant);

            _log.Info("Restaurant added: " + restaurant.GetCommand() + " (" + restaurant.GetName() + ")");
        }
Beispiel #2
0
        /// <summary>
        ///     Returns the current menu of the given restaurant.
        /// </summary>
        /// <param name="restaurantCommand"></param>
        /// <returns></returns>
        public string GetMenu(string restaurantCommand)
        {
            IRestaurant restaurant = _restaurants.Find(x => x.GetCommand().Equals(restaurantCommand));

            if (restaurant == null)
            {
                throw new Exception("Unknown restaurant: " + restaurantCommand.Substring(0, 100));
            }

            StatisticsCollector.GetInstance().IncrementExecutedRestaurantMenuRequestCount();

            _log.Info("Getting menu of restaurant: " + restaurant.GetName());

            return(restaurant.GetCurrentMenu());
        }