public async Task <IActionResult> Index() { var viewModel = new HomeViewModel() { NationalParks = await _nationalParkRepository.GetAll(AppConstants.NationalParkApiPath), Trails = await _trailRepository.GetAll(AppConstants.TrailsApiPath) }; return(View(viewModel)); }
public IActionResult GetTrails() { var trails = _trailRepository.GetAll(); var trailsDTO = new List <TrailDTO>(); foreach (var trail in trails) { trailsDTO.Add(_mapper.Map <TrailDTO>(trail)); } return(Ok(trailsDTO)); }
public async Task <IActionResult> GetAllTrails() { return(Json(new { data = await _trailRepository.GetAll(AppConstants.TrailsApiPath) })); }