Ejemplo n.º 1
0
        public IActionResult Index()
        {
            ViewBag.Stadiums = repo.GetAllStadiums();
            var stadiums = repo.GetAllStadiums();

            return(View(stadiums));
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            var model = new IndexPageViewModel()
            {
                Stadiums = _stadiumRepo.GetAllStadiums()
            };

            return(View(model));
        }
        public async Task <ActionResult <IEnumerable <StadiumResponse> > > GetAllStadiums()
        {
            try
            {
                var stadiums = await _repository.GetAllStadiums();

                var stadiumsResponseMapping = new List <StadiumResponse>();

                foreach (var s in stadiums)
                {
                    var stadiumResponseMapping = _mapper.Map <StadiumResponse>(s);
                    stadiumsResponseMapping.Add(stadiumResponseMapping);
                }

                _logger.LogInformation($"Stadiums have been downloaded.");
                return(Ok(stadiumsResponseMapping));
            }
            catch (System.Exception ext)
            {
                _logger.LogError(ext, "Failed to download stadiums list.");
                // TODO return error object with proper error code.
                return(BadRequest());
            }
        }
Ejemplo n.º 4
0
        public IActionResult Stadiums()
        {
            var stadiums = repo.GetAllStadiums();

            return(View(stadiums));
        }