Asad Rehman
Asad Rehman

Reputation: 25

How to get all rows on basis of a condition from entity framework

I am building a website using MVC ASP.Net. In the website when user clicks a category, then i want to find all the items having that category as foreign key from entity framework database. I came across method of Find() but it doesn't fulfill my requirement. What I want is something like

Database1Entities.Categories.Select(x => x.Cat_Id == Id);

But I dont know the exact way to do this. Any Help will be highly appreciated.

Upvotes: 1

Views: 13854

Answers (1)

AmmarCSE
AmmarCSE

Reputation: 30557

How about using Where()

Database1Entities.Categories.Where(x => x.Cat_Id == Id);

Upvotes: 8

Related Questions