I want to provide 2 condition's in the COUNT clause for checking ROLE & USERID.
Here is my code :-
var recordCount = ctx.Cases.Count();
How to give Where condition in Count()?
I want to provide 2 condition's in the COUNT clause for checking ROLE & USERID.
Here is my code :-
var recordCount = ctx.Cases.Count();
How to give Where condition in Count()?
Just add a predicate to your Count()
expression (and don't forget to include System.Linq
):
var recordCount = ctx.Cases.Count(a => a.Role == "admin");
First give Where and then count.
ctx.Cases.Where(c => your condition).Count();