public async Task <IHttpActionResult> GetByMatch(int matchId) { return(await TryCatchAsync(async() => { var players = await _playersServices.GetAllByMatch(matchId); return Ok(players); })); }
public async Task <IEnumerable <MatchListOutputDto> > GetAll() { var matches = await _matchesRepository.GetAllAsync(); var matchesListOutputDto = MappingConfig.Mapper().Map <List <MatchListOutputDto> >(matches); foreach (var matchListOutputDto in matchesListOutputDto) { var totalPlayers = await _playersServices.GetAllByMatch(matchListOutputDto.Id); matchListOutputDto.TotalPlayers = $"{totalPlayers.Count()}/{matchListOutputDto.MinimumPlayers}"; } return(matchesListOutputDto.OrderByDescending(o => o.CreateDate)); }