Пример #1
0
        public ActionResult Index(int?pageIndex, int?pageSize)
        {
            int    index   = pageIndex ?? 1;
            int    size    = pageSize ?? biPageSize;
            string content = String.Empty;

            if (Session["searchText_b"] != null && Session["searchText_b"].ToString() != "")
            {
                content = (string)Session["searchText_b"];
            }
            int             count = bookManager.GetCount(content);
            List <BookInfo> list  = bookManager.PagingFindBookInfo(content, index, size);
            Pager           page  = new Pager(index, size, count);

            ViewData["page"] = page;
            return(View(list));
        }
Пример #2
0
        public ActionResult Index(string keyword, string type, int?pageIndex, int?pageSize)
        {
            int             index   = pageIndex ?? 1;
            int             size    = pageSize ?? showSize;
            int             count   = 0;
            List <BookInfo> list    = new List <BookInfo>();
            string          content = String.Empty;

            if (!string.IsNullOrEmpty(keyword))
            {
                content                 = keyword;
                ViewBag.Content         = keyword;
                Session["searchText_g"] = null;
            }
            if (Session["searchText_g"] != null && Session["searchText_g"].ToString() != "")
            {
                content = (string)Session["searchText_g"];
            }

            if (!string.IsNullOrEmpty(type))
            {
                BookType t = typeManager.FindById(type);
                ViewBag.Content = t.TypeName;
                count           = bookManager.GetTypeCount(type);
                list            = bookManager.FindByType(type, index, size);
            }
            else
            {
                count = bookManager.GetCount(content);
                list  = bookManager.PagingFindBookInfo(content, index, size);
            }
            Pager page = new Pager(index, size, count);

            ViewData["page"] = page;
            return(View(list));
        }