Biarity / Sieve

⚗️ Clean & extensible Sorting, Filtering, and Pagination for ASP.NET Core
Other
1.21k stars 131 forks source link

Unable to use with existing list #185

Closed DiponRoy closed 1 year ago

DiponRoy commented 1 year ago

Here I already have a list called users and I am trying to apply a filter. In the apply method, i passed users.AsQueryable(), but its not working as expected. I don't find any overloads from IEnumerable.

[HttpGet]
public JsonResult GetPosts(SieveModel sieveModel) 
{
    List<User> users = new List<User>(); 
    var result = users.AsQueryable();                       // Makes read-only queries faster
    result = _sieveProcessor.Apply(sieveModel, result);     // Returns `result` after applying the sort/filter/page query in `SieveModel` to it
    return Json(result.ToList());
}

Is there any option to make it work?

DiponRoy commented 1 year ago

was missing the mapping config