コード例 #1
0
 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))
     });
 }
コード例 #2
0
            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()
                });
            }
コード例 #3
0
            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)
                });
            }