public async Task <Response> Handle(Request request)
 {
     return(new Response()
     {
         Team = TeamApiModel.FromTeam(await _context.Teams
                                      .Include(x => x.Tenant)
                                      .SingleAsync(x => x.Id == request.Id && x.Tenant.UniqueId == request.TenantUniqueId))
     });
 }
Example #2
0
            public async Task <Response> Handle(Request request)
            {
                var teams = await _context.Teams
                            .Include(x => x.Tenant)
                            .Where(x => x.Tenant.UniqueId == request.TenantUniqueId)
                            .ToListAsync();

                return(new Response()
                {
                    Teams = teams.Select(x => TeamApiModel.FromTeam(x)).ToList()
                });
            }
Example #3
0
            public async Task <Response> Handle(Request request)
            {
                var team = await _cache.FromCacheOrServiceAsync(() => _context
                                                                .Users
                                                                .Include(x => x.Tenant)
                                                                .Include(x => x.CurrentTeam)
                                                                .Where(x => x.Username == request.Username && x.Tenant.UniqueId == request.TenantUniqueId)
                                                                .Select(x => x.CurrentTeam)
                                                                .SingleAsync(), $"[Current Team] CurrentTeam: {request.TenantUniqueId}-{request.Username}");

                return(new Response()
                {
                    Team = TeamApiModel.FromTeam(team)
                });
            }