Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 294
Asad Rehman Avatar asked Jan 18 '26 06:01

Asad Rehman


1 Answers

How about using Where()

Database1Entities.Categories.Where(x => x.Cat_Id == Id);
like image 153
AmmarCSE Avatar answered Jan 19 '26 18:01

AmmarCSE



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!