public TargetWithUserSpecification(TargetSearchParams targetSearchParams) : base(x => (string.IsNullOrEmpty(targetSearchParams.Search) || x.Name.ToLower().Contains(targetSearchParams.Search)) && (!targetSearchParams.UserId.HasValue || x.UserId == targetSearchParams.UserId) && x.Status ) { AddInclude(x => x.User); AddOrderBy(x => x.Name); ApplyPaging(targetSearchParams.Skip, targetSearchParams.Take); if (!string.IsNullOrEmpty(targetSearchParams.Sort)) { switch (targetSearchParams.Sort) { case "nameDesc": AddOrderByDescending(p => p.Name); break; default: AddOrderBy(p => p.Name); break; } } }
public TargetWithFiltersForCountSpecification(TargetSearchParams targetSearchParams) : base(x => (string.IsNullOrEmpty(targetSearchParams.Search) || x.Name.ToLower().Contains(targetSearchParams.Search)) && (!targetSearchParams.UserId.HasValue || x.UserId == targetSearchParams.UserId) && x.Status ) { }