Exemplo n.º 1
0
        public async Task <IActionResult> Detail()
        {
            //读取redis设置的其中一个string值
            string value1 = await RedisProvider.StringGet("ZeosonY");

            string value2 = await RedisProvider.StringGet("XuZ");

            string value3 = await RedisProvider.StringGet("Owen");

            string value4 = await RedisProvider.StringGet("Actor");

            string value5 = await RedisProvider.StringGet("Director");

            //读取redis设置的list
            List <string> list = await RedisProvider.ListRange("MyList", 0, -1);

            //读取设置的cookie
            string cookie1 = Tools.Utility.CookieHelper.GetValue("YZX");
            string cookie2 = Tools.Utility.CookieHelper.GetValue("XXX");

            //测试分页
            int page = RequestInt("page");

            page = page == 0 ? 1 : page;
            long   records  = 0;
            int    pageSize = 10;
            var    userList = Bll.BllUser.Instance.GetPageList(page, pageSize, out records);
            string pageHtml = GetPageHtml(page, pageSize, records, 5, "/Home/Detail?page={0}");

            ViewBag.cookie1  = cookie1;
            ViewBag.cookie2  = cookie2;
            ViewBag.name1    = value1;
            ViewBag.name2    = value2;
            ViewBag.name3    = value3;
            ViewBag.name4    = value4;
            ViewBag.name5    = value5;
            ViewBag.list     = list;
            ViewBag.userList = userList;
            ViewBag.pageHtml = pageHtml;
            return(View(UserService.CurrentUser));
        }