public async Task <ActionResult <ICollection <TeamResponse> > > GetAsync() { var query = new GetTeamsQuery(); var teams = await _getTeamsQueryHandler.HandleAsync(query); return(Ok(teams)); }
public async Task <List <TeamResponse> > Handle(GetTeamsQuery request, CancellationToken cancellationToken) { var teams = await _statisticsDbContext.GetTeams().ToListAsync(cancellationToken); var mappedTeams = teams.Select(x => x.ToTeamResponse()).ToList(); return(mappedTeams); }
public async Task <ICollection <TeamResponse> > HandleAsync(GetTeamsQuery query) { return(await _context.Team.Select(t => new TeamResponse() { TeamId = t.Id, Name = t.Name }).ToListAsync()); }
public TeamsController(TeamCommunicationDbContext context) { _context = context; this.factory = new DbContextFactory(); this.query = new GetTeamsQuery(factory.CreateDbContext); this.topicRepo = new TopicRepository(factory); this.repo = new TeamRepository(factory); this.facade = new TeamFacade(repo, query); }
public UserTeamsController(TeamCommunicationDbContext context) { _context = context; this.factory = new DbContextFactory(); this.repo = new UserTeamRepository(factory); this.query = new GetUserTeamsQuery(factory.CreateDbContext); this.facade = new UserTeamFacade(repo, query); this.teamRepo = new TeamRepository(factory); this.teamQuery = new GetTeamsQuery(factory.CreateDbContext); this.teamFacade = new TeamFacade(teamRepo, teamQuery); this.userRepo = new UserRepository(factory); this.usersQuery = new GetUsersQuery(factory.CreateDbContext); this.userFacade = new UserFacade(userRepo, usersQuery); }
public async Task <IEnumerable <TeamDto> > Handle(GetTeamsQuery request, CancellationToken cancellationToken) { var teams = await context.Teams .Include(team => team.Country) .OrderBy(t => t.Name).ToListAsync(); if (teams != null) { return(teams.Select(t => new TeamDto { Name = t.Name, Country = t.Country?.Name })); } return(null); }
public async Task <IList <Models.Teams.TeamModel> > Teams_GetTeams(GetTeamsQuery getTeamsQuery) { var result = await AttemptAndRetry(() => WasabeeApiClient.Teams_GetTeams(getTeamsQuery), new CancellationToken()).ConfigureAwait(false); return(result.IsSuccessStatusCode ? result.Content : new List <Models.Teams.TeamModel>()); }
public TeamFacade(TeamRepository repository, GetTeamsQuery query) { this.repository = repository; this.query = query; }