Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetPagedList orderBy parameter #144

Open
BrianARice opened this issue Oct 22, 2020 · 2 comments
Open

GetPagedList orderBy parameter #144

BrianARice opened this issue Oct 22, 2020 · 2 comments

Comments

@BrianARice
Copy link

BrianARice commented Oct 22, 2020

My database table Plan has a column called SortBy that I want to use to order the request... the below code is giving me the error: 'IQueryable' does not contain a definition for 'SortBy' and no accessible extension method 'SortBy' accepting a first argument of type 'IQueryable' could be found (are you missing a using directive or an assembly reference?)

        var repoPlan = _unitOfWork.GetRepository<Plan>();
        var list = repoPlan.GetPagedList(predicate: p => p.IsActive == true, orderBy: p => p.SortBy, pageIndex: skip, pageSize: take);

Any help on how to do this properly?

@issue-label-bot
Copy link

Issue Label Bot is not confident enough to auto-label this issue. See dashboard for more details.

@VergilGao
Copy link

using System.Linq;

...

repo.GetPagedList(orderBy: x => x.OrderBy(p => p.SortBy));
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants