ASP.Net MVC LINQ question

Associate
Joined
25 Feb 2007
Posts
905
Location
Midlands
So I'm diving in to MVC having used Web Forms previously.

I'm also dabbling with LINQ for the first time!

I'm making a 'Tasks' application, and tasks can have people assigned to them, so in my database I have 3 tables -
Code:
Tasks (ID, Description)
People (ID, Name)
PeopleTasks (ID, TaskID, PeopleID, Primary)

I've created a model from this in MVC5 and 'scaffolded' a controller and views for each table.

My issue now is that in the tasks index, which currently just shows the description of the task, I want to add the persons name, but only if the PersonTask Primary field is true (there can only be one Primary person per task).

I've written a LINQ query which filters on the Primary field, but then I don't seem to be able to select both the task and related person.

Hope this makes sense! :D
 
Back
Top Bottom