Example #1
0
        public async Task <SearchInGroupResult> SearchInGroupAsync(FeedFilter filter)
        {
            var groupOfSearch = await _feedRepository.GetInGroupAsync(filter);

            var createdByIds = groupOfSearch.Articles.Select(x => x.CreatedById)
                               .Concat(groupOfSearch.Products.Select(x => x.CreatedById))
                               .Concat(groupOfSearch.Farms.Select(x => x.CreatedById)).Distinct();
            var createdByPictures = await _userPhotoRepository.GetUserPhotoByUserIdsAsync(createdByIds, UserPictureType.Avatar);

            var createdByUsers = await _userRepository.GetNameByIdsAsync(createdByIds);

            await SetPicturesForSearchResultAsync(groupOfSearch, createdByUsers, createdByPictures);

            return(groupOfSearch);
        }