Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
 public async Task <IActionResult> GetAllNationalPark()
 {
     return(Json(new { data = await _npRepo.GetAllAsync(SD.NationalParkApiPath, HttpContext.Session.GetString("JWT")) }));
 }