예제 #1
0
        private CompetitionStandingDto LoadCrazyDypStandings(FinalDayCompetition competition)
        {
            var compDto = new CompetitionStandingDto
            {
                CompetitionId    = competition.Id,
                CompetitionName  = competition.Name,
                CompetitionMode  = competition.CompetitionMode,
                CompetitionState = competition.State
            };

            var sqlExpression = Db.From <CompetitionPlayerStanding>()
                                .Where(x => x.FinalDayCompetitionId == competition.Id)
                                .ThenBy(x => x.Rank);

            var standings = Db.LoadSelect(sqlExpression).ToList();

            compDto.Players = standings.Select(x => x.ConvertTo <CompetitionPlayerStandingDto>()).ToList();
            return(compDto);
        }
예제 #2
0
        private CompetitionStandingDto LoadGroupStandings(FinalDayCompetition competition)
        {
            // TODO SSH: Refactor this -> Duplicated code just above...
            var compDto = new CompetitionStandingDto
            {
                CompetitionId    = competition.Id,
                CompetitionName  = competition.Name,
                CompetitionMode  = competition.CompetitionMode,
                CompetitionState = competition.State
            };

            var sqlExpression = Db.From <CompetitionTeamStandingView>()
                                .Where(x => x.FinalDayCompetitionId == competition.Id)
                                .OrderBy(x => x.GroupId)
                                .ThenBy(x => x.Rank);

            var standings = Db.Select(sqlExpression).ToList();

            compDto.Groups = MapToCompetitionTeamStandingDto(standings);
            return(compDto);
        }