Exemple #1
0
        public static IQueryable <PrimaryContact> ApplyPrimaryContactFiltering(this IQueryable <PrimaryContact> query, PrimaryContactQuery queryObj)
        {
            if (queryObj.Active)
            {
                query = query.Where(pc => pc.Active);
            }
            else
            {
                query = query.Where(pc => pc.Active == false);
            }


            if (!string.IsNullOrWhiteSpace(queryObj.SearchTerm))
            {
                query = query.Where(pc => pc.Name.Contains(queryObj.SearchTerm) ||
                                    pc.Email.Contains(queryObj.SearchTerm) ||
                                    pc.Function.Contains(queryObj.SearchTerm) ||
                                    pc.Telephone.Contains(queryObj.SearchTerm));
            }

            return(query);
        }
        public IHttpActionResult getPrimaryContactsByQuery([FromBody] PrimaryContactQuery filterResource)
        {
            var queryResult = _unitOfWork.PrimaryContacts.GetPrimaryContactByQuery(filterResource);

            return(Ok(queryResult));
        }