var userExists = await dbContext.Users.AnyAsync(u => u.Name == "John"); if(userExists){ Console.WriteLine("User with name John exists"); }
var outOfStock = await dbContext.Products.AnyAsync(p => p.Stock == 0); if(outOfStock){ Console.WriteLine("Some products are out of stock"); }This method is part of the System.Data.Entity package library.