Esempio n. 1
0
        public static Criterion <Blog> Keyword(string keyword)
        {
            if (string.IsNullOrWhiteSpace(keyword))
            {
                return(new TrueCriterion <Blog>());
            }

            keyword = keyword.ToLower();

            var urlCriterion = new DirectCriterion <Blog>(c => c.Url.ToLower().Contains(keyword));

            return(urlCriterion);
        }
Esempio n. 2
0
        public static Criterion <Role> Keyword(string keyword)
        {
            if (string.IsNullOrWhiteSpace(keyword))
            {
                return(new TrueCriterion <Role>());
            }

            keyword = keyword.ToLower();

            var nameCriterion        = new DirectCriterion <Role>(c => c.Name.Contains(keyword));
            var descriptionCriterion = new DirectCriterion <Role>(c => c.Description.Contains(keyword));

            var criterion = nameCriterion && descriptionCriterion;

            return(criterion);
        }
        public void SatisfiedBy_Test()
        {
            var criteria = new DirectCriterion <EntityOne>(c => c.Id == 1);

            Assert.Equal("c => (c.Id == 1)", criteria.SatisfiedBy().ToString());
        }