Пример #1
0
        public BoardGameGeekGameSummary GetBoardGameGeekGameSummary(int boardGameGeekGameDefinitionId, ApplicationUser currentUser, int numberOfRecentlyPlayedGamesToRetrieve = DEFAULT_NUMBER_OF_GAMES)
        {
            var topChampions      = _universalTopChampionsRetreiver.GetFromSource(boardGameGeekGameDefinitionId);
            var boardGameGeekInfo = _boardGameGeekGameDefinitionInfoRetriever.GetResults(boardGameGeekGameDefinitionId);
            var universalStats    = _universalStatsRetriever.GetResults(boardGameGeekGameDefinitionId);
            GameDefinitionSummary gamingGroupGameDefinitionSummary = null;

            if (currentUser.CurrentGamingGroupId.HasValue)
            {
                gamingGroupGameDefinitionSummary = GetGamingGroupGameDefinitionSummary(boardGameGeekGameDefinitionId,
                                                                                       currentUser.CurrentGamingGroupId.Value, numberOfRecentlyPlayedGamesToRetrieve);
            }

            var filter = new RecentlyPlayedGamesFilter
            {
                BoardGameGeekGameDefinitionId = boardGameGeekGameDefinitionId,
                NumberOfGamesToRetrieve       = numberOfRecentlyPlayedGamesToRetrieve
            };
            var recentlyPlayedPublicGames = _recentPublicGamesRetriever.GetResults(filter);

            return(new BoardGameGeekGameSummary
            {
                BoardGameGeekInfo = boardGameGeekInfo,
                UniversalGameStats = universalStats,
                GamingGroupGameDefinitionSummary = gamingGroupGameDefinitionSummary,
                RecentlyPlayedGames = recentlyPlayedPublicGames,
                TopChampions = topChampions
            });
        }
Пример #2
0
        public virtual ActionResult Index()
        {
            var recentPlayerAchievements = _recentPlayerAchievementsUnlockedRetreiver.GetResults(new GetRecentPlayerAchievementsUnlockedQuery {
                PageSize = NUMBER_OF_RECENT_ACHIEVEMENTS_TO_SHOW
            });
            var recentPlayerAchievementsViewModel =
                recentPlayerAchievements.ToMappedPagedList(_mapperFactory.GetMapper <PlayerAchievement, PlayerAchievementWinnerViewModel>());

            var recentlyPlayedGamesFilter = new RecentlyPlayedGamesFilter
            {
                NumberOfGamesToRetrieve = NUMBER_OF_RECENT_PUBLIC_GAMES_TO_SHOW
            };
            var publicGameSummaries = _recentPublicGamesRetriever.GetResults(recentlyPlayedGamesFilter);

            var topGamingGroups = _topGamingGroupsRetriever.GetResults(NUMBER_OF_TOP_GAMING_GROUPS_TO_SHOW);

            var topGamingGroupViewModels = topGamingGroups.Select(_transformer.Transform <TopGamingGroupSummaryViewModel>).ToList();

            var trendingGamesRequest   = new TrendingGamesRequest(NUMBER_OF_TRENDING_GAMES_TO_SHOW, NUMBER_OF_DAYS_OF_TRENDING_GAMES);
            var trendingGames          = _trendingGamesRetriever.GetResults(trendingGamesRequest);
            var trendingGameViewModels = trendingGames.Select(_transformer.Transform <TrendingGameViewModel>).ToList();

            var homeIndexViewModel = new HomeIndexViewModel()
            {
                RecentAchievementsUnlocked = recentPlayerAchievementsViewModel,
                RecentPublicGames          = publicGameSummaries,
                TopGamingGroups            = topGamingGroupViewModels,
                TrendingGames = trendingGameViewModels
            };

            ViewBag.NumTrendingGameDays = NUMBER_OF_DAYS_OF_TRENDING_GAMES;
            return(View(MVC.Home.Views.Index, homeIndexViewModel));
        }
Пример #3
0
        public virtual ActionResult RecentPlayedGames()
        {
            var recentlyPlayedGamesFilter = new RecentlyPlayedGamesFilter
            {
                NumberOfGamesToRetrieve = NUMBER_OF_RECENT_PUBLIC_GAMES_TO_SHOW,
                MaxDate = DateTime.UtcNow.Date.AddDays(1)
            };
            var publicGameSummaries = _recentPublicGamesRetriever.GetResults(recentlyPlayedGamesFilter);

            return(PartialView(MVC.PlayedGame.Views._RecentlyPlayedGamesPartial, publicGameSummaries));
        }