Filter Conditional ASP MVC NuGet Package

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 .




Got any Filter Conditional ASP MVC Question?





Info

Version: 1.0.0
Author(s): Vitek Ivanov
Last Update: Wednesday, March 2, 2016
.NET Fiddle: Create the first Fiddle
NuGet Url: https://www.nuget.org/packages/FilterConditional


Install
Install-Package FilterConditional
dotnet add package FilterConditional
paket add FilterConditional
FilterConditional Download (Unzip the "nupkg" after downloading)



Tags



STATS

must-have-score

avg-downloads-per-day

0

days-since-last-release

3186