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

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

Retrieves the team from a given contest which contains a given member.
public static GetTeamFromUserIdAndContestId ( int userId, int contestId, bool loadMembers ) : ContestTeam
userId int ID of the user to match the team to.
contestId int ID of the contest to match the team to.
loadMembers bool Indicates whether or not the team member lists should be populated.
Результат ActivEarth.Objects.Competition.Contests.ContestTeam
        public static ContestTeam GetTeamFromUserIdAndContestId(int userId, int contestId, bool loadMembers)
        {
            using (SqlConnection connection = ConnectionManager.GetConnection())
            {
                var data = new ActivEarthDataProvidersDataContext(connection);
                int teamId = (from c in data.TeamMemberDataProviders
                        where c.user_id == userId && c.contest_id == contestId
                        select c.team_id).FirstOrDefault();

                return TeamDAO.GetTeamFromTeamId(teamId, loadMembers);
            }
        }