public async Task <Response> Handle(Request request) { return(new Response() { CompletedScheduledExercise = CompletedScheduledExerciseApiModel.FromCompletedScheduledExercise(await _context.CompletedScheduledExercises .Include(x => x.Tenant) .SingleAsync(x => x.Id == request.Id && x.Tenant.UniqueId == request.TenantUniqueId)) }); }
public async Task <Response> Handle(Request request) { var completedScheduledExercises = await _context.CompletedScheduledExercises .Include(x => x.Tenant) .Where(x => x.Tenant.UniqueId == request.TenantUniqueId) .ToListAsync(); return(new Response() { CompletedScheduledExercises = completedScheduledExercises.Select(x => CompletedScheduledExerciseApiModel.FromCompletedScheduledExercise(x)).ToList() }); }