Esempio n. 1
0
        public List <PersonBasicWebModel> GetFriends(int myAthleteID, int athleteID)
        {
            bool confirmedOnly = myAthleteID != athleteID;
            var  query         = new FriendshipLogic(db).GetFriendsQuery(athleteID, confirmedOnly);

            return(getBasic(myAthleteID, query, 1000));
        }
Esempio n. 2
0
        public List <PersonBasicWebModel> Find(int myAthleteID, string nameQuery, bool myFriendsOnly, Country country = null, int?metroID = null, bool includeMyself = false)
        {
            var query = (from a in db.Athletes
                         where includeMyself == true || a.AthleteID != myAthleteID
                         select a);

            if (myFriendsOnly)
            {
                query = new FriendshipLogic(db).GetFriendsQuery(myAthleteID, false);
            }

            if (string.IsNullOrEmpty(nameQuery) == false)
            {
                nameQuery = nameQuery.Trim();
                if (nameQuery != "")
                {
                    query = (from a in query//db.Athletes
                             where a.Name.Contains(nameQuery)
                             select a);
                }
            }

            if (country != null)
            {
                query = (from a in query
                         where a.Country == country.ThreeLetterCode
                         select a);
            }

            if (metroID != null)
            {
                query = (from a in query
                         where a.MetroID == metroID.Value
                         select a);
            }

            return(this.getBasic(myAthleteID, query));
        }