I have the following query:
if (entities.User.Count(u => u.Id == ownerUserId && u.GroupId == null) == 0)
I want to check if User with Id == ownerUserId has its GroupId == null, but it doesn’t work.
Table:
User
----------------------------------------
Id | PK Not Null
GroupId | FK to Group Table. CAN BE NULL.
...
I want to check if User with Id == ownerId has GroupId == null
Do you know why?
If you want the if condition to be true in the case you mentioned, you would need to check for greater than 0, rather than equal to 0.