// View player's career by ID
        public ActionResult Index(String id)
        {
            List <PlayerAchievement> playerAchievements = null;
            PlayerAchievement        playerAchievement;

            playerAchievements = _repository.GetPlayerAchievementsByPlayerID(id)
                                 .Where(achievement => achievement.PlayerID.Equals(id)).ToList();

            if (playerAchievements.Count() == 0)
            {
                playerAchievement          = new PlayerAchievement();
                playerAchievement.PlayerID = id;
                playerAchievement.Player   = _playerRepository.GetPlayerByID(id);
                playerAchievements.Add(playerAchievement);
                return(View(playerAchievements));
            }
            else
            {
                foreach (var achievement in playerAchievements)
                {
                    achievement.Achievement = _achievementRepository.GetAchievementByName(achievement.AchievementName);
                    achievement.Player      = _playerRepository.GetPlayerByID(achievement.PlayerID);
                }
                return(View(playerAchievements));
            }
        }
Beispiel #2
0
        // GET: PlayerAchievements
        public ActionResult Index(String id)
        {
            //var playerAchievements = _repository.GetPlayerAchievementsByPlayerID(id);
            ////var playerAchievements = db.PlayerAchievements.Include(p => p.achievement);
            //return View(playerAchievements.ToList());
            List <PlayerAchievement> l = new List <PlayerAchievement>();

            return(View(_repository.GetPlayerAchievementsByPlayerID(id)));
        }
 public ActionResult ShowAchievementsList(String playerID)
 {
     return(View(_repository.GetPlayerAchievementsByPlayerID(playerID)));
 }