public async Task <ActionResult <List <LeagueDto> > > Get() { var leagues = await _leagueManager.GetAvailableLeaguesAsync(); if (leagues == null || !leagues.Any()) { return(BadRequest()); } return(leagues); }
public async Task <List <MatchDto> > GetScheduledMatchesAsync() { var availableLeagues = await _leagueManager.GetAvailableLeaguesAsync(); var availableLeaguesId = availableLeagues.Select(x => x.Id).ToList(); var matches = await _unitOfWork.MatchRepository.GetScheduledMatchesByLeaguesId(availableLeaguesId); if (matches == null) { return(null); } return(_mapper.Map <List <Match>, List <MatchDto> >(matches)); }