Example #1
0
        public override Specification <Country> GetSpecification()
        {
            var spec = new Specification <Country>();

            if (!Ids.IsEmpty())
            {
                int[] ids = ArrayHelpers.StringToIntArray(Ids);
                if (ids != null && ids.Length > 0)
                {
                    spec.And(c => ids.Contains(c.Id));
                }
            }
            if (!Name.IsEmpty())
            {
                spec.And(c => c.Name.StartsWith(Name));
            }
            if (!Abbreviation.IsEmpty())
            {
                spec.And(c => c.Abbreviation.StartsWith(Abbreviation));
            }
            if (!ShowAll)
            {
                spec.And(c => c.Enabled == true);
            }
            return(spec);
        }