public async Task <IActionResult> Index() { IndexVM listOfParksAndTrails = new IndexVM() { NationalParkList = await _npRepo.GetAllAsync(SD.NationalParkApiPath, HttpContext.Session.GetString("JWT")), TrailList = await _trailRepo.GetAllAsync(SD.TrailsApiPath, HttpContext.Session.GetString("JWT")) }; return(View(listOfParksAndTrails)); }
public async Task <IActionResult> Upsert(int?id) { IEnumerable <NationalPark> npList = await _npRepo.GetAllAsync(SD.NationalParkApiPath, HttpContext.Session.GetString("JWT")); TrailVM objVM = new TrailVM(); objVM.nationalParkList = npList; objVM.Trail = new Trail(); if (id == null) { return(View(objVM)); } objVM.Trail = await _trailRepo.GetAsync(SD.TrailsApiPath, id.GetValueOrDefault(), HttpContext.Session.GetString("JWT")); if (objVM.Trail == null) { return(NotFound()); } return(View(objVM)); }
public async Task <IActionResult> GetAllNationalPark() { return(Json(new { data = await _npRepo.GetAllAsync(SD.NationalParkApiPath, HttpContext.Session.GetString("JWT")) })); }