public ActionResult Schedule(int id)
 {
     var diet = _dietRepository.Get(id);
     var dietViewModel = Mapper.Map<Diet, DietViewModel>(diet);
     var dietCalculator = new DietCalculator(diet, _ingredientQuantityRepository, _tracer);
     dietViewModel.Ingredients = Mapper.Map<IEnumerable<DietIngredient>, IEnumerable<DietIngredientViewModel>>(diet.DietIngredients);
     dietViewModel.Meals = Mapper.Map<IEnumerable<DietMeal>, IEnumerable<DietMealViewModel>>(diet.DietMeals);
     return View(dietViewModel);
 }
 public ActionResult Details(int id)
 {
     var diet = _dietRepository.Get(id);
     var dietViewModel = Mapper.Map<Diet, DietViewModel>(diet);
     var dietCalculator = new DietCalculator(diet, _ingredientQuantityRepository, _tracer);
     dietViewModel.Ingredients = Mapper.Map<IEnumerable<DietIngredient>, IEnumerable<DietIngredientViewModel>>(diet.DietIngredients);
     dietViewModel.Meals = Mapper.Map<IEnumerable<DietMeal>, IEnumerable<DietMealViewModel>>(diet.DietMeals);
     dietViewModel.Kcal = dietCalculator.CalculateAverageKcal();
     dietViewModel.Fat = dietCalculator.CalculateFatPercentage();
     dietViewModel.Carb = dietCalculator.CalculateCarbPercentage();
     dietViewModel.Protein = dietCalculator.CalculateProteinPercentage();
     return View(dietViewModel);
 }