I need help getting data from multiple Entities models into an MVC controller. Most of the examples I have seen for using EF in an MVC2 app only use a single entitiy.
I have just started using MVC2 in C# using the Entity Framework models (CIOps.model) created from an SQL database. I can create the controller and views using single tables of the model in MVC2, but I just cannot get my head around how to get data from multiple entity tables into the controller (similar to joins in T-SQL). I have included an example below of the controller code that works with a single entity table, tbl_tours (tbl_tour in DB).
Could someone please illustrate how this code would be changed to include additional columns from FK tables in addition to tbl_tours columns. E.g. the clients name from the tbl_clients, the coordinators name from the tbl_employees, and costs from tbl_costs entities? Is it possible to do this directly using the EF model entities/classes that are already created and not use LINQ, POCO, Repositories, etc.? The FK relationships are already in the EF models.
I have included the whole controller code, but I just need a few examples of how to join the multiple entities, not rewrite every CRUD function function in the controller. I think this will get me over the hump in using EF in an MVC2 App. Also i
View Complete Post