Exemple #1
0
        public string AddFood(string type, string name, decimal price)
        {
            var food = foodFactory.CreateFood(type, name, price);

            this.menu.Add(food);
            return($"Added {name} ({type}) with price {price:f2} to the pool");
        }
        public string AddFood(string type, string name, decimal price)
        {
            var food = foodFactory.CreateFood(type, name, price);

            this.menu.Add(food);
            return(String.Format(OutputMessages.ADD_Food, food.Name, food.GetType().Name, food.Price));
        }
        public string AddFood(string type, string name, decimal price)
        {
            IFood food = foodFactory.CreateFood(type, name, price);

            this.menu.Add(food);

            return(string.Format(Messages.SuccessfulyAddedFood, food.Name, type, food.Price));
        }
Exemple #4
0
        public string AddFood(string type, string name, decimal price)
        {
            var    food   = foodFactory.CreateFood(type, name, price);
            string result = string.Empty;

            if (food != null)
            {
                this.menu.Add(food);
                result = $"Added {food.Name} ({food.GetType().Name}) with price {food.Price:f2} to the pool";
            }

            return(result);
        }
Exemple #5
0
        public string AddFood(string type, string name, decimal price)
        {
            var foodFactory = new FoodFactory();

            try
            {
                var food = foodFactory.CreateFood(type, name, price);

                var message = $"Added {food.Name} ({food.GetType().Name}) with price {food.Price} to the pool";
                this.Foods.Add(food);
                return(message);
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }