public async Task <ActionResult <IEnumerable <LeagueDTO> > > GetLeagues(string country, [FromQuery] string[] leagueNames)
        {
            try
            {
                var result = await _leagueService.FindAsync(new FindLeagueParams
                {
                    Country     = country,
                    LeagueNames = leagueNames.Any() ? leagueNames : null
                });

                return(Ok(result));
            }
            catch (ArgumentException aEx)
            {
                return(NotFound(aEx.Message));
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Details(string id)
        {
            if (id == null)
            {
                throw new ApplicationException($"Passed ID parameter is absent.");
            }

            var league = await _leagueService.FindAsync(id);

            if (league == null)
            {
                throw new ApplicationException($"Unable to find league with ID '{id}'.");
            }

            var model = new LeagueDetailsViewModel(league);

            return(View(model));
        }