public PostWithFiltersForCountSpecification(PostSpecParams postParams) : base(x => (string.IsNullOrEmpty(postParams.Search) || x.Title.ToLower().Contains(postParams.Search)) && (!postParams.CategoryId.HasValue || x.CategoryId == postParams.CategoryId) ) { }
// for list view public PostWithSpecification(PostSpecParams postParams) : base(x => (string.IsNullOrEmpty(postParams.Search) || x.Title.ToLower().Contains(postParams.Search)) && (!postParams.CategoryId.HasValue || x.CategoryId == postParams.CategoryId) ) { AddOrderByDesc(x => x.Id); AddInclude(x => x.ApplicationUser); AddInclude(x => x.Category); ApplyPaging(postParams.PageSize * (postParams.PageIndex - 1), postParams.PageSize); }