コード例 #1
0
 public IQueryable <TeamLeague> GetTeamLeaguesForSeason(int seasonId) //string orderByProperty
 {
     return(from tl in teamLeagueRepository.Get()
            where tl.League.Season.Id == seasonId
            orderby tl.League.DivisionNo, tl.TeamName
            select tl);
 }
コード例 #2
0
 public IQueryable <Team> GetTeamsForLeague(int leagueId)
 {
     return(from t in teamLeagueRepository.Get()
            where t.League.Id == leagueId
            orderby t.TeamName
            select t.Team);
 }
コード例 #3
0
        public TeamLeague UpdateTeamLeaguePenaltyPoints(int leagueId, int teamId)
        {
            TeamLeague teamLeague = null;

            IQueryable <Penalty> teamPenalty = penaltyRepository.GetByTeamAndLeagueId(teamId, leagueId);

            int points = 0;

            if (teamPenalty.Count() > 0)
            {
                points = teamPenalty.Sum(p => p.Points);
            }

            // Get the associated team league and update the penalty points
            // This is a bit dodge
            teamLeague = (teamLeagueRepository.Get(x => (x.League.Id == leagueId && x.Team.Id == teamId))).First();

            if (teamLeague != null)
            {
                teamLeague.PointsPenalty = points;
            }

            return(teamLeague);
        }
コード例 #4
0
 public TeamLeague GetTeamLeague(int id)
 {
     return(teamLeagueRepository.Get(id));
 }
コード例 #5
0
 public int GetTotalWins(int teamId)
 {
     return((from tl in teamLeagueRepository.Get()
             where tl.Team.Id == teamId
             select tl.GamesWonTotal).Sum());
 }