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

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

Queries the DB to see if a user is registered for a particular contest.
public static UserCompetingInContest ( int userId, int contestId ) : bool
userId int ID of the user.
contestId int ID of the contest to query.
Результат bool
        public static bool UserCompetingInContest(int userId, int contestId)
        {
            try
            {
                using (SqlConnection connection = ConnectionManager.GetConnection())
                {
                    var data = new ActivEarthDataProvidersDataContext(connection);
                    return ((from c in data.TeamMemberDataProviders
                                              where c.user_id == userId && c.contest_id == contestId
                                              select c.team_id).FirstOrDefault()) > 0;
                }
            }
            catch (Exception)
            {
                return false;
            }
        }