Пример #1
0
        public int AddProductToMeal(ItemManager _itemManager)
        {
            double howManyGrmasOfProduct;
            var    dayHolder  = GetDay();
            var    mealHolder = GetMealFromDay(dayHolder);

            //var itemHolder = _itemManager.GetItem();
            do
            {
                Console.Clear();
                Console.WriteLine("Type how many grams of choosen product You want to add...");
            }while (!double.TryParse(Console.ReadLine(), out howManyGrmasOfProduct));

            var itemInMealHolder = new ItemInMeal(_itemManager.GetItem(), howManyGrmasOfProduct);

            _dayService.AddProductToMeal(itemInMealHolder, mealHolder, dayHolder);

            Console.WriteLine("Added grams of product: " + itemInMealHolder.Weight);
            Console.WriteLine("Total Carbs: " + mealHolder.TotalCarbs);
            Console.WriteLine("Total fat: " + mealHolder.TotalFat);
            Console.WriteLine("Total kcal: " + mealHolder.TotalKcal);
            Console.WriteLine("Total protein: " + mealHolder.TotalProtein);

            return(itemInMealHolder.Id);
        }