FilterConditional 1.0.0

Filter Conditional ASP MVC

var fb = new ConditionalFilterGenerator<Your Entity>(Request.RequestUri.ParseQueryString(), new ConditionalFilterBuilder());

COMMENT:
first example

fb.And<int>((e, i) => e.Id > i, "id")
               .And<int>((e, i) => e.Id < 4, "Id")
               .Or<string>((e, s) => e.Name.StartsWith(s), "name");
COMMENT:
second example. This example contains in section 'Or' parameter type of boolean.
This parameter is talking if name-value 'Id' has been existed early in expression it is will not be used
NOTE: If name-value "id" or "name" not exists in the collection QueryString then expression will be skipped and will be used the expression 'Or'

fb.And<int, IEnumerable<string>>((e, i, a) => e.Id == i && a.Any(s => e.Name.StartsWith(s)), "id", "name")
               .Or<int>((e, i) => e.Id == 5, false, "id");

COMMENT:predicate result
var result = fb.GetConditional();

//In Controller will need add attribute
[ModelBinder(typeof(Your ModelBinder))]Expression<Func<Your Entity, bool>> pr  

Install-Package FilterConditional -Version 1.0.0
dotnet add package FilterConditional --version 1.0.0
<PackageReference Include="FilterConditional" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FilterConditional --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Dependencies

This package has no dependencies.

Version History

Version Downloads Last updated
1.0.0 456 3/2/2016