Link to home
Start Free TrialLog in
Avatar of Steven
StevenFlag for United States of America

asked on

is it posible to use operators with _context

good afternoon,
I was wondering if it is posible to use operators like OR/AND as follow in asp.net

 if (_context.User.Any(ac => ac.Id.Equals(23) && ac.Active.Equals(1)))

Open in new window


or what is the right way of doing something similar to that.

I appreciate your help thanks.
Avatar of louisfr
louisfr

I think User is not an IEnumerable. You cannot use the method Any on it.
Avatar of Steven

ASKER

Maybe I should've written what I was trying to accomplish, I'm trying to check if a specific user is active.
thanks
My last comment was just a thought I had when reading your code and I forgot to actually answer the question.
You can use boolean operators in asp.net. Are you getting an error when you use them?
Avatar of Steven

ASKER

Im new to MVC, so im not sure if what I was doing was posible, this is the error I get System.ArgumentException: 'DbComparisonExpression requires arguments with comparable types.'
ASKER CERTIFIED SOLUTION
Avatar of Snarf0001
Snarf0001
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Most probable cause of the problem