public IActionResult Index() { ViewBag.Stadiums = repo.GetAllStadiums(); var stadiums = repo.GetAllStadiums(); return(View(stadiums)); }
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()); } }
public IActionResult Stadiums() { var stadiums = repo.GetAllStadiums(); return(View(stadiums)); }