Ejemplo n.º 1
0
        public async Task <TeamsQueryResponse> Handle(TeamsQuery cmd)
        {
            var teams = await teamRepository.GetTeams(id : cmd.TeamId);

            return(new TeamsQueryResponse {
                Teams = mapper.Map <IEnumerable <Team> >(teams)
            });
        }
Ejemplo n.º 2
0
        public async Task <TeamsQueryResponse> Handle(TeamsQuery cmd)
        {
            var teams = (await teamRepository.QueryTeams(new TeamQuery {
                Id = cmd.TeamId, AssignedCommunityCode = cmd.CommunityCode
            })).Items;

            return(new TeamsQueryResponse {
                Teams = mapper.Map <IEnumerable <EMBC.ESS.Shared.Contracts.Team.Team> >(teams)
            });
        }
        public async Task <IEnumerable <TeamDTO> > Handle(TeamsQuery request, CancellationToken cancellationToken)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            var teams = await _context.Teams
                        .Include(t => t.Members)
                        .ToListAsync();

            return(_mapper.Map <IEnumerable <TeamDTO> >(teams));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult <IEnumerable <AssignedCommunity> > > GetAssignedCommunities([FromQuery] bool forAllTeams = false)
        {
            var query = new TeamsQuery();

            if (!forAllTeams)
            {
                query.TeamId = teamId;
            }

            var teams = (await messagingClient.Send(query)).Teams;

            var communities = teams.SelectMany(t => t.AssignedCommunities.Select(c => new { CommunityCode = c.Code, DateAssigned = c.DateAssigned, Team = t }));

            return(Ok(communities.Select(c => new AssignedCommunity
            {
                TeamId = c.Team.Id,
                TeamName = c.Team.Name,
                CommunityCode = c.CommunityCode,
                DateAssigned = c.DateAssigned
            })));
        }
Ejemplo n.º 5
0
 public Task <IActionResult> GetTeams(TeamsQuery query) => ExecuteQuery(query);