public List <ScoreModel> getAllScores() { ScoreDataService scoreDS = new ScoreDataService(); List <ScoreModel> scores = scoreDS.ReadAll(); AccountDataService accountDS = new AccountDataService(); foreach (ScoreModel score in scores) { score.UserName = accountDS.Read(score.UserId).UserName; } return(scores); }
public List <IEnumerable <ScoreModel> > getHighScores() { ScoreDataService scoreDS = new ScoreDataService(); List <ScoreModel> scores = scoreDS.ReadAll(); AccountDataService accountDS = new AccountDataService(); foreach (ScoreModel score in scores) { score.UserName = accountDS.Read(score.UserId).UserName; } List <IEnumerable <ScoreModel> > highScores = new List <IEnumerable <ScoreModel> >(); var highScoresEasy = (from score in scores where score.Difficulty == 0 orderby score select score).Take(5); highScores.Add(highScoresEasy); var highScoresMedium = (from score in scores where score.Difficulty == 1 orderby score select score).Take(5); highScores.Add(highScoresMedium); var highScoresHard = (from score in scores where score.Difficulty == 2 orderby score select score).Take(5); highScores.Add(highScoresHard); return(highScores); }