Esempio n. 1
0
        //trả về sản phẩm
        public ActionResult InitListBook(int pagenum, string searchname, string madm, string manxb, string searchby)
        {
            try
            {
                List <MyBook> list = PhanTich(searchname, manxb, madm, searchby);

                int sosp = list.Count();

                ViewInfo info = new ViewInfo();
                //tính toán first last product
                ProductIndex pdi = helper.GetProductsIndex(pagenum, sosp, info.SoSPHienThi);
                list = list.Skip(pdi.FirstProduct).Take(pdi.LastProduct - pdi.FirstProduct + 1).ToList();
                return(new JsonResult {
                    Data = list, JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            catch (Exception) { return(new JsonResult {
                    Data = new List <MyBook>(), JsonRequestBehavior = JsonRequestBehavior.AllowGet
                }); }
        }