Example #1
0
        public async Task <IActionResult> Index()
        {
            var viewModel = new HomeViewModel()
            {
                NationalParks = await _nationalParkRepository.GetAll(AppConstants.NationalParkApiPath),
                Trails        = await _trailRepository.GetAll(AppConstants.TrailsApiPath)
            };

            return(View(viewModel));
        }
Example #2
0
        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));
        }
Example #3
0
 public async Task <IActionResult> GetAllTrails()
 {
     return(Json(new { data = await _trailRepository.GetAll(AppConstants.TrailsApiPath) }));
 }