RecipeViewModel ( RecipeDto), :
select new RecipeViewModel
{
hh.Key.IDRecipe,
Score = hh.Sum(s => s.Score)
}).OrderByDescending(i => i.Score));
,
, ( ) Recipe . , , , . , - Recipe, Score:
from r in db.Recipes
where
select new RecipeViewModel
{
Id = r.Id,
Score = r.StarRatings.Sum(rating => rating.Score)
}
, Recipe.StarRatings. , join . ( ).