public async Task <Response> Handle(Request request) { return(new Response() { Athlete = AthleteApiModel.FromAthlete(await _context.Athletes .Include(x => x.Tenant) .SingleAsync(x => x.Id == request.Id && x.Tenant.UniqueId == request.TenantUniqueId)) }); }
public async Task <Response> Handle(Request request) { var athletes = await _context.Athletes .Include(x => x.Tenant) .Where(x => x.Tenant.UniqueId == request.TenantUniqueId) .ToListAsync(); return(new Response() { Athletes = athletes.Select(x => AthleteApiModel.FromAthlete(x)).ToList() }); }
public async Task <Response> Handle(Request request) { var athletes = await _context.Athletes.ToListAsync(); var athlete = await _context.Athletes.SingleOrDefaultAsync(x => x.Username == request.Username); if (athlete == null) { return(new Response()); } return(new Response() { Athlete = AthleteApiModel.FromAthlete(athlete) }); }