public virtual ActionResult CurrentPlayerQuickStats(ApplicationUser currentUser)
        {
            var playerQuickStats          = playerRetriever.GetPlayerQuickStatsForUser(currentUser.Id, currentUser.CurrentGamingGroupId);
            var playerQuickStatsViewModel = Mapper.Map <PlayerQuickStatsViewModel>(playerQuickStats);

            return(View(MVC.Player.Views.CurrentPlayerQuickStats, playerQuickStatsViewModel));
        }
Beispiel #2
0
        public virtual HomePagePlayerSummary GetHomePagePlayerSummaryForUser(string applicationUserId, int gamingGroupId)
        {
            var quickStats = _playerRetriever.GetPlayerQuickStatsForUser(applicationUserId, gamingGroupId);

            var homePagePlayerSummary = _transformer.Transform <HomePagePlayerSummary>(quickStats);

            var lastPlayedGameForGamingGroupList = _playedGameRetriever.GetRecentGames(1, gamingGroupId);

            if (lastPlayedGameForGamingGroupList.Count == 1)
            {
                var lastGame = lastPlayedGameForGamingGroupList[0];
                homePagePlayerSummary.LastGamingGroupPlayedGame = new PlayedGameQuickStats
                {
                    DatePlayed         = lastGame.DatePlayed,
                    GameDefinitionName = lastGame.GameDefinition.Name,
                    GameDefinitionId   = lastGame.GameDefinitionId,
                    PlayedGameId       = lastGame.Id,
                    WinnerType         = lastGame.WinnerType
                };

                if (lastGame.WinningPlayer != null)
                {
                    homePagePlayerSummary.LastGamingGroupPlayedGame.WinningPlayerId   = lastGame.WinningPlayer.Id;
                    homePagePlayerSummary.LastGamingGroupPlayedGame.WinningPlayerName = lastGame.WinningPlayer.Name;
                }

                var bggGameDefinition = lastGame.GameDefinition.BoardGameGeekGameDefinition;

                if (bggGameDefinition != null)
                {
                    homePagePlayerSummary.LastGamingGroupPlayedGame.BoardGameGeekUri  = BoardGameGeekUriBuilder.BuildBoardGameGeekGameUri(bggGameDefinition.Id);
                    homePagePlayerSummary.LastGamingGroupPlayedGame.ThumbnailImageUrl = bggGameDefinition.Thumbnail;
                }
            }

            return(homePagePlayerSummary);
        }