В бронировании столбцов есть идентичные значения .timeslotid < /code>.
нам нужно сгруппировать их (orderbydescending?) И взять последнее значение (LastordefaultAsync?). < /p>
Я думаю, что это подквира public async Task GetByPatient(Guid patientId)
{
var entities = await _context.Bookings
.Include(item => item.Doctor) // Connection of the external table 1
.Include(item => item.Timeslot) // Connection of the external table 2
.Where(item => item.PatientId == patientId && item.IsBooked == true)
// ... ?
.ToListAsync(); // here we need ToList for to create Dto on the next step
var Dtos = entities
.Select(b => new BookingDTO(.....))
.ToList();
return Dtos;
}
Подробнее здесь: https://stackoverflow.com/questions/796 ... tical-ones