I am writing a question with LINQ to join li. How do I get the result table with 3 table combinations? I have to combine the table in one line. Any ideas?
Peole
---------------
Id | 1 Id |2
Name | David Name |Ameyy
Surname| David1 Surname |Ameyy2
Appointment
---------------
Id |19
PeopleId |1
Subject |description
Participant
---------------
Id |1 Id |2
AppointmentId |19 AppointmentId |19
PeopleId |1 PeopleId |2
Result
----------------------------------
Id | 1
Subject | Subject
Participant| David David1, Ameyy Ameyy2
Linq query;
IQueryable<AppointmentPoolModel> query = db.Randevu.Join(db.Kisi,
appointment => appointment .TALEPEDENKISI,
people=> people.ID,
(appointment , people)
=> new AppointmentPoolModel
{
Id = appointment.ID,
Subject = appointment.Subject,
Note = appointment .NOTLAR,
NameSurname = people.Name+ " " + people.Surname,
RequestedId = people.ID,
//Participan = string.Join(",", )
});
var result = query.OrderBy(appointment => randevu.AppointmentStartDate).ToList();
You should investigate step by step.
Here a example withtwo dedicated joins and a groupBy (which is missing in your case):
You can try this.