예제 #1
0
        // GET: CategoryController
        public async Task <IActionResult> Index(int?page)
        {
            ViewBag.Active = 2;
            if (page == null)
            {
                page = 1;
            }
            var pageSize   = 6;
            var pageNumber = page ?? 1;
            var Token      = HttpContext.Session.GetString("Token");

            if (_userClient.CheckToken(Token, User.Identity.Name) == null)
            {
                return(Redirect("/Administration/Home/Login"));
            }
            else
            {
                if (Token == null)
                {
                    Token = await _userClient.CheckToken(Token, User.Identity.Name);
                }
            }
            var list = _categoryApi.GetAll(Token).Result.OrderByDescending(x => x.Id).ToPagedList(pageNumber, pageSize);

            return(View(list));
        }
        public async Task <IActionResult> Index(int?page)
        {
            if (page == null)
            {
                page = 1;
            }
            int pageNumber = page ?? 1;
            int pageSize   = 6;

            ViewBag.Active = 4;
            var Token = HttpContext.Session.GetString("Token");

            if (_userApiClient.CheckToken(Token, User.Identity.Name) == null)
            {
                return(Redirect("/Administration/Home/Login"));
            }
            else
            {
                if (Token == null)
                {
                    Token = await _userApiClient.CheckToken(Token, User.Identity.Name);
                }
            }
            var listReport_Vm = _reportApiClient.GetAll(Token).Result;

            return(View(listReport_Vm.ToPagedList(pageNumber, pageSize)));
        }