/*
         * public IActionResult Index()
         * {
         *  return View();
         * }
         */

        // 11. Part 2
        // ----------------------------

        public async Task <IActionResult> Index()
        {
            var asd = HttpContext.Session.GetString("JWToken");

            IndexVM indexVM = new IndexVM()
            {
                NationalParkList = await _npRepo.GetAllSync(_npUrl, HttpContext.Session.GetString("JWToken")),
                TrailList        = await _trailRepo.GetAllSync(_trailUrl, HttpContext.Session.GetString("JWToken"))
            };

            return(View(indexVM));
        }
Beispiel #2
0
        /* Note About Index()
         * // In the tutorial he make Index action method return empty object. And make other async method that return the Trails object.
         * // And that new method will be called by jQuery ajax from the view when call dataTables plugin. so he make that thing because he want to call the data from the datatable plugin.
         * // As there is no reason for me to this, i worked in the normal way.
         */

        public async Task <IActionResult> Index()
        {
            var trailDtos = await _trailRepo.GetAllSync(_trailUrl, HttpContext.Session.GetString("JWToken"));

            return(View(trailDtos));
        }