0

I am new to LINQ and I feel some difficulties to write that LINQ query.

I need to write LINQ TO ENTITY to check if table named Reviews where all rows with siteId=5 has at least one row with column named isValid that equal false if there is, I need to return false if not return true.

1
  • 1
    Give it a try at-least. Hint: Use Any. Commented Nov 2, 2015 at 10:56

1 Answer 1

1

Create a Filter with SiteId

IEnumerable<Review> FilteredReviews = Reviews.Where(x=>x.SiteId == 5)

Check whether any value of IsValid is False, return accordingly

return FilteredReviews.Any(y=>!y.IsValid) ? false : true
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.