Example #1
0
        public override PlayerAchievementViewModel Map(PlayerAchievement source)
        {
            var result = base.Map(source);

            var achievement = AchievementFactory.GetAchievementById(source.AchievementId);

            result.Achievement    = _achievementToAchievementViewModelMapper.Map(achievement);
            result.PlayerProgress = achievement.IsAwardedForThisPlayer(result.PlayerId).PlayerProgress;

            switch (achievement.Group)
            {
            case AchievementGroup.Game:
                result.RelatedGameDefinitions =
                    _gameDefinitionRetriever.GetGameDefinitionSummaries(source.RelatedEntities)
                    .Select(g => _gameDefinitionSummaryToGameDefinitionSummaryListViewModelMapper.Map(g))
                    .ToList();
                break;

            case AchievementGroup.Player:
                result.RelatedPlayers =
                    _playerRetriever.GetPlayers(source.RelatedEntities)
                    .Select(g => _playerToPlayerListSummaryViewModelMapper.Map(g))
                    .ToList();
                break;

            case AchievementGroup.PlayedGame:
                result.RelatedPlayedGames =
                    _playedGameRetriever.GetPlayedGamesQuickStats(source.RelatedEntities)
                    .Select(g => _playedGameQuickStatsToPlayedGameQuickStatsViewModelMapper.Map(g))
                    .ToList();
                break;
            }

            return(result);
        }
Example #2
0
        public override PlayerAchievementSummaryViewModel Map(PlayerAchievement source)
        {
            var result = base.Map(source);

            var achievement = AchievementFactory.GetAchievementById(source.AchievementId);

            result.Achievement = _achievementToAchievementViewModelMapper.Map(achievement);
            return(result);
        }