I've got this complex situation.
Created EF with "Model first" and here are my EF entities:
-Course Lecturer many to many relationship- Course Lecturer ------------ ------------------- Column IS_PROFESOR is bool +ID +ID value that makes Lecturer: +NAME +FIRSTNAME true: Course Profesor ----------- +LASTNAME false: Course Asistent -LECTURERS +IS_PROFESOR ----------- ------------------- -COURSES -------------------
Now -LECTURERS and -COURSES are navigation properties. From this tables in database i need to query data and put them in some Model so i can get following Course Index View
--------------------------------------------------------------------------------- Course | Professor | Assistants | Actions --------------------------------------------------------------------------------- course 1 | course professor |assistant 1 | edit update delete | |assistant 2 | edit update delete --------------------------------------------------------------------------------- course 2 | course professor |assistant 1 | edit update delete --------------------------------------------------------------------------------- course 3 | course professor |assistant 1 | edit update delete | |assistant 2 | edit update delete | |assistant 3 | edit update delete ---------------------------------------------------------------------------------
As you can see i need query that will populate some new View Model in that way that it can distinct Course Professor from Course Assistants list. Model will be (right?):
public class CourseView
{
public int CourseID { get; set; }
public string CourseName { get; set; }
public string ProfessorName { get; set; }
public List AssistantNames { get; set; } // Or it should be List of Assistants
}
No way i can think of some rational solution for this problem with my own skills, any help, reference or suggestion will mean a lot for me,thx for every second of looking at this.