Exemple #1
0
        public IHttpActionResult ListOrganizations()
        {
            var searchCriteria = new coreModel.MembersSearchCriteria
            {
                MemberType = typeof(coreModel.Organization).Name,
                DeepSearch = true,
                Take       = int.MaxValue
            };
            var result = _memberSearchService.SearchMembers(searchCriteria);

            return(Ok(result.Members));
        }
        public IHttpActionResult ListOrganizations()
        {
            var searchCriteria = new coreModel.MembersSearchCriteria
            {
                MemberType = typeof(coreModel.Organization).Name,
                DeepSearch = true,
                Take = int.MaxValue
            };
            var result = _memberSearchService.SearchMembers(searchCriteria);

            return Ok(result.Members);
        }
        protected override Expression<Func<MemberDataEntity, bool>> GetQueryPredicate(MembersSearchCriteria criteria)
        {
            var retVal = base.GetQueryPredicate(criteria);
            if (!String.IsNullOrEmpty(criteria.Keyword))
            {
                //where x or (y1 or y2)
                var predicate = PredicateBuilder.False<MemberDataEntity>();
                //search in special properties
                predicate = predicate.Or(x => (x is ContactDataEntity && (x as ContactDataEntity).FullName.Contains(criteria.Keyword)));
                predicate = predicate.Or(x => (x is EmployeeDataEntity && (x as EmployeeDataEntity).FullName.Contains(criteria.Keyword)));
                //Should use Expand() to all predicates to prevent EF error
                //http://stackoverflow.com/questions/2947820/c-sharp-predicatebuilder-entities-the-parameter-f-was-not-bound-in-the-specif?rq=1
                retVal = LinqKit.Extensions.Expand(retVal.Or(LinqKit.Extensions.Expand(predicate)));
            }
            return retVal;

        }
Exemple #4
0
        public IHttpActionResult Search(coreModel.MembersSearchCriteria criteria)
        {
            var result = _memberSearchService.SearchMembers(criteria);

            return(Ok(result));
        }