public IEnumerable <DiarySearchResult> AddOrder(IEnumerable <DiarySearchResult> CurrentResult) { List <Tuple <long, long> > diariesScore = _diaryStatisticRepository.GetDiaryViewsCount(buildMatchPattern(CurrentResult)); var resultWithScores = from diarySearchResult in CurrentResult join diaryScore in diariesScore on diarySearchResult.Diary.Id equals diaryScore.Item1 select(new { diarySearchResult, diaryScore }); return(resultWithScores.OrderByDescending(x => x.diaryScore).Select(x => x.diarySearchResult)); }
private void SetDiaryStatistics(DiaryDto diaryDto) { diaryDto.ViewCount = _diaryStatisticRepository.GetDiaryViewsCount(diaryDto.Id); }