void InitialiseOverallRankingListView() { var averageScores = new List <Tuple <string, int> >(); foreach (var c in Repo.GetAllCouples()) { var averageScore = Repo.GetAllScores().Where(x => x.CoupleID == c.CoupleID).Average(x => x.ScoreValue); averageScores.Add(new Tuple <string, int>(c.CoupleName, (int)averageScore)); } RankingListView.Initialise(this, averageScores, Resource.Id.overallRankingListview, "The competition has not started yet."); }
void UpdateRankingsListView() { var scores = Repo.GetAllScores().Where(x => x.WeekNumber == SelectedWeek); var couples = Repo.GetAllCouples().Where(x => scores.Select(y => y.CoupleID).Contains(x.CoupleID)); var weekScores = new List <Tuple <string, int> >(); foreach (var c in couples) { var coupleScore = scores.FirstOrDefault(x => x.CoupleID == c.CoupleID).ScoreValue; weekScores.Add(new Tuple <string, int>(c.CoupleName, coupleScore)); } RankingListView.Initialise(this, weekScores, Resource.Id.scoresList, "There are no results for this week."); }
void UpdateDanceRankingsListView() { var scores = Repo.GetAllScores().Where(x => x.DanceID == Dance?.DanceId).ToList(); var couplesInScores = Repo.GetAllCouples().Where(x => scores.Select(z => z.ScoreID).Contains(x.CoupleID)).ToList(); var couplesDanceScores = new List <Tuple <string, int> >(); foreach (var c in couplesInScores) { var couplesDanceScore = scores.FirstOrDefault(x => x.CoupleID == c.CoupleID).ScoreValue; couplesDanceScores.Add(new Tuple <string, int>(c.CoupleName, couplesDanceScore)); } RankingListView.Initialise(this, couplesDanceScores, Resource.Id.rankingByDanceListView, "This dance has not been performed by any couple yet"); }