Пример #1
0
        public IEnumerable <GameListItemViewModel> GetLatest(Guid currentUserId, int count, Guid userId, Guid?teamId, GameGenre genre)
        {
            IQueryable <Game> allModels = gameDomainService.Get(genre, userId, teamId);

            IOrderedQueryable <Game> ordered = allModels.OrderByDescending(x => x.CreateDate);

            IQueryable <Game> taken = ordered.Take(count);

            List <GameListItemViewModel> vms = taken.ProjectTo <GameListItemViewModel>(mapper.ConfigurationProvider).ToList();

            foreach (GameListItemViewModel item in vms)
            {
                item.ThumbnailUrl        = SetFeaturedImage(item.UserId, item.ThumbnailUrl, ImageRenderType.Full);
                item.ThumbnailResponsive = SetFeaturedImage(item.UserId, item.ThumbnailUrl, ImageRenderType.Responsive);
                item.ThumbnailLquip      = SetFeaturedImage(item.UserId, item.ThumbnailUrl, ImageRenderType.LowQuality);
                item.DeveloperImageUrl   = UrlFormatter.ProfileImage(item.UserId, 40);

                UserProfile authorProfile = GetCachedProfileByUserId(item.UserId);
                item.DeveloperName = authorProfile.Name;
            }

            return(vms);
        }