Пример #1
0
        public IEnumerable <T> Search <T>(string searchTerm, Guid?userId = null, Guid?callerId = null, bool isAdmin = false, short top = 100, int?radius = null)
            where T : Profile, new()
        {
            callerId = !callerId.HasValue || callerId.Value == Guid.Empty ? (Guid?)null : callerId.Value;
            userId   = !userId.HasValue || userId.Value == Guid.Empty ? (Guid?)null : userId.Value;

            var proc = new UserSearchProfile()
            {
                Keyword = string.IsNullOrWhiteSpace(searchTerm) ? null : searchTerm,
                ConnectionIdentifier = userId,
                Top = top,
                CallerIdentifier = isAdmin ? AdministratorIdentifier : callerId,
                Radius           = radius.HasValue && radius == 0 ? (int?)null : radius,
            };

            return(proc.CallObjects <T>());
        }
Пример #2
0
        public IEnumerable <Profile> Friends(Profile profile, short?top = null)
        {
            if (null == profile)
            {
                throw new ArgumentNullException("profile");
            }
            if (Guid.Empty == profile.Identifier)
            {
                throw new ArgumentException("Identifier");
            }

            var sp = new UserSearchProfile()
            {
                CallerIdentifier     = profile.Identifier,
                ConnectionIdentifier = profile.Identifier,
                Top = top,
            };

            return(sp.CallObjects <Profile>());
        }