public IEnumerable <ChallengeDTO> GetChallengesByUser(int userId) { var repo = new ChallengeRepository(); var challengeIds = repo.GetChallengeIdsByUser(userId); var myChallenges = new List <ChallengeDTO>(); foreach (var challengeId in challengeIds) { var challenge = repo.GetChallege(challengeId); myChallenges.Add(challenge); } return(myChallenges); }