示例#1
0
        public Expression <Func <Company, bool> >[] GetSearchExpressions()
        {
            List <Expression <Func <Company, bool> > > expressions = new List <Expression <Func <Company, bool> > >();

            if (!string.IsNullOrEmpty(CNPJ))
            {
                expressions.Add(x => x.CNPJ.ToLower().Contains(CNPJ.ToLower()));
            }

            if (!string.IsNullOrEmpty(FantasyName))
            {
                expressions.Add(x => x.FantasyName.ToLower().Contains(FantasyName.ToLower()));
            }

            if (!string.IsNullOrEmpty(CompanyName))
            {
                expressions.Add(x => x.CompanyName.ToLower().Contains(CompanyName.ToLower()));
            }

            return(expressions.ToArray());
        }