Код: Выделить всё
from comps in ctx.TblControls
join reviews in ctx.TblReviews on comps.Id equals reviews.ControlId
join tags in ctx.TblTags on comps.TagId equals tags.Id
join framework in ctx.TblFrameworks on comps.FrameworkId equals framework.Id
where comps.Guid == guid
select new
{
ratingTotal = ((ctx.TblReviews.Where(x => x.Rating == 5).Count() * 5) + (ctx.TblReviews.Where(x => x.Rating == 4).Count() * 4) + (ctx.TblReviews.Where(x => x.Rating == 3).Count() * 3) + (ctx.TblReviews.Where(x => x.Rating == 2).Count() * 2) + (ctx.TblReviews.Where(x => x.Rating == 1).Count() * 1)),
ratingValue = ctx.TblReviews.Where(x => x.Rating == 5).Count() + ctx.TblReviews.Where(x => x.Rating == 4).Count() + ctx.TblReviews.Where(x => x.Rating == 3).Count() + ctx.TblReviews.Where(x => x.Rating == 2).Count() + ctx.TblReviews.Where(x => x.Rating == 1).Count(),
reviews,
tags,
framework,
comps
}
return View(new { componentData = componentData.FirstOrDefault() });
Подробнее здесь: https://stackoverflow.com/questions/794 ... ow-with-mu