I'm using a scaffold-ed index function to get all the data from the database.
// Scaffold-ed index():
public ActionResult Index()
{
return View(db.Objects.ToList());
}
// Database tables:
[ObjectID] [Name]
1 Tree
2 Plant
3 Flower
4 Tree
Instead of all the objects, I only what the objects with a certain name (for example: tree). What is the best solution for this and should this be done with methods like db.Objects.Find(), Where(),.. or with a custom query?
db.Objects.Where(w=> w.Name=="SomeName").ToList()