ActivEarth.DAO.TeamDAO.GetTeamsFromContestId C# (CSharp) Метод

GetTeamsFromContestId() публичный статический Метод

Retrieves all teams competing in a particular contest.
public static GetTeamsFromContestId ( int contestId, bool loadMembers ) : List
contestId int ID of the contest to load teams for.
loadMembers bool Indicates whether or not the team member lists should be populated.
Результат List
        public static List<ContestTeam> GetTeamsFromContestId(int contestId, bool loadMembers)
        {
            using (SqlConnection connection = ConnectionManager.GetConnection())
            {
                var data = new ActivEarthDataProvidersDataContext(connection);
                List<ContestTeam> teams =  (from c in data.TeamDataProviders
                                    where c.contest_id == contestId
                                    select
                                        new ContestTeam
                                        {
                                            ID = c.id,
                                            Name = c.name,
                                            Score = (float)c.score,
                                            IsLocked = c.locked,
                                            GroupId = c.group_id,
                                            ContestId = c.contest_id,
                                            Bracket = c.bracket
                                        }).ToList();

                if (loadMembers)
                {
                    foreach (ContestTeam team in teams)
                    {
                        team.Members = GetTeamMembersFromTeamId(team.ID);
                    }
                }

                return teams;
            }
        }