public static List <Tuple <double, Recipe> > GetRecipesForPerson(this GroupMeal meal, int personId)
 {
     return
         (meal.Recipes.Where(r => r.ApplyForPerson(personId))
          .Select(r => new Tuple <double, Recipe>(r.Adjustments.Single(ad => ad.PersonId == personId).AmountMultiplier, r.Recipe))
          .ToList());
 }
        private void AddMealSummary(DietSummary dietSummary, GroupMeal meal, int personId)
        {
            var mealSumamry = CreateMealSummary(meal, personId);

            dietSummary.NutritionValues += mealSumamry;

            dietSummary.CaloriesPerMeal.Add(mealSumamry.Calories);
        }
        private NutritionValues CreateMealSummary(GroupMeal meal, int personId)
        {
            var mealSummary     = new NutritionValues();
            var recipes         = meal.GetRecipesForPerson(personId);
            var nutritionValues = recipes.Select(r => r.Item2.NutritionValues * (r.Item1 * r.Item2.NominalWeight / 100.0)).ToList();

            nutritionValues.ForEach(v => mealSummary += v);

            return(mealSummary);
        }