public async Task <BranchAppointmentListViewModel> GetBranchAppointments(GetBranchAppointmentsQuery query, CancellationToken cancellationToken = default)
        {
            var branch = await _context.Branches
                         .Where(x => x.BranchId == query.BranchId)
                         .Select(BranchAppointmentListViewModel.AsQueryableProjection)
                         .FirstOrDefaultAsync(cancellationToken);

            var appointments = await _context.Appointments
                               .Where(x => x.BranchId == query.BranchId && x.ArrivalDate.Date == query.SearchDate)
                               .Select(BranchAppointmentViewModel.AsQueryableProjection)
                               .ToListAsync(cancellationToken);

            branch.Appointments = appointments;

            return(branch);
        }
Exemple #2
0
 public async Task <ActionResult> GetBranchAppointments(GetBranchAppointmentsQuery request)
 {
     return(Ok(await _appointmentSchedulerService.GetBranchAppointments(request)));
 }