Skip to content

Commit 9bc4285

Browse files
MilosMilos
Milos
authored and
Milos
committed
Add Negative filter
1 parent 8f811e0 commit 9bc4285

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/JsonApiDotNetCore/Extensions/IQueryableExtensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ private static Expression GetFilterExpressionLambda(Expression left, Expression
195195
case FilterOperations.like:
196196
body = Expression.Call(left, "Contains", null, right);
197197
break;
198+
// {model.Id != 1}
199+
case FilterOperations.ne:
200+
body = Expression.NotEqual(left, right);
201+
break;
198202
default:
199203
throw new JsonApiException(500, $"Unknown filter operation {operation}");
200204
}

src/JsonApiDotNetCore/Internal/Query/FilterOperations.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public enum FilterOperations
88
gt = 2,
99
le = 3,
1010
ge = 4,
11-
like = 5
11+
like = 5,
12+
ne = 6
1213
}
13-
}
14+
}

0 commit comments

Comments
 (0)