public ProjectsWithMembersSpecification(ProjectSpecParams projectParams)
            : base(x =>
                   (string.IsNullOrEmpty(projectParams.Search) || x.Name.ToLower().Contains(projectParams.Search)))
        {
            AddInclude(x => x.Members);

            AddOrderBy(x => x.Name);
            ApplyPaging(projectParams.PageSize * (projectParams.PageIndex - 1), projectParams.PageSize);

            if (!string.IsNullOrEmpty(projectParams.Search))
            {
                switch (projectParams.Sort)
                {
                case "idAsc":
                    AddOrderBy(x => x.Id);
                    break;

                case "idDesc":
                    AddOrderByDescending(x => x.Id);
                    break;

                default:
                    AddOrderBy(x => x.CreateDate);
                    break;
                }
            }
        }
Exemple #2
0
 public ProjectsWithFiltersForCountSpecification(ProjectSpecParams projectParams)
     : base(x =>
            (string.IsNullOrEmpty(projectParams.Search) || x.Name.ToLower().Contains(projectParams.Search)))
 {
 }