Exemple #1
0
        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);
        }
Exemple #3
0
 public async Task <ICollection <TeamResponse> > HandleAsync(GetTeamsQuery query)
 {
     return(await _context.Team.Select(t => new TeamResponse()
     {
         TeamId = t.Id,
         Name = t.Name
     }).ToListAsync());
 }
Exemple #4
0
 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);
 }
Exemple #5
0
 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);
 }
Exemple #6
0
        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);
        }
Exemple #7
0
        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>());
        }
Exemple #8
0
 public TeamFacade(TeamRepository repository, GetTeamsQuery query)
 {
     this.repository = repository;
     this.query      = query;
 }