public void InitProperties() { var matches = AppDelegate.SharedAppDelegate.UoW.MatchRepo.GetActualMatches(AppDelegate.SharedAppDelegate.UoW.LeagueRepo.GetAllLeague()); SoonMatches = matches.Where(m => m.State != StateEnum.Playing).OrderBy(m => m.LeagueId); if (SoonMatches.Count() == 0) { HasSoonMatch = false; } else { HasSoonMatch = true; SoonTeams = AppDelegate.SharedAppDelegate.UoW.TeamRepo.GetTeamsByMatches(SoonMatches); SoonIndexes = CreateIndexes(SoonMatches); } LiveMatches = matches.Where(m => m.State == StateEnum.Playing).OrderBy(m => m.LeagueId); if (LiveMatches.Count() == 0) { HasLiveMatch = false; } else { HasLiveMatch = true; LiveTeams = AppDelegate.SharedAppDelegate.UoW.TeamRepo.GetTeamsByMatches(LiveMatches); LiveIndexes = CreateIndexes(LiveMatches); } }
public override nint RowsInSection(UITableView tableView, nint section) { if (section == 0) { if (!HasLiveMatch) { return(1); } return(LiveMatches.Count() + LiveMatches.DistinctBy(m => m.LeagueId).Count()); } if (!HasSoonMatch) { return(1); } return(SoonMatches.Count() + SoonMatches.DistinctBy(m => m.LeagueId).Count()); }