//search and paging
        public ActionResult Search(string keyword, int page = 1, int pageSize = 2)
        {
            var productView = new ProductViewHome();
            int totalRecord = 0;

            //get list pet food sale off
            ViewBag.viewPetFoodSaleOff = productView.getViewPetFoodSaleOff();
            //get list search
            var allPetfood = new PetFoodModel().Search(keyword, ref totalRecord, page, pageSize);

            ViewBag.keyword = keyword;
            ViewBag.Total   = totalRecord;
            ViewBag.Page    = page;

            int maxPage   = 5;//maximum page display on website
            int totalPage = 0;

            totalPage = (int)Math.Ceiling((double)totalRecord / pageSize);

            ViewBag.totalPage = totalPage;
            ViewBag.maxPage   = maxPage;
            // first page
            ViewBag.first = 1;
            //last page
            ViewBag.last = totalPage;
            //next page
            ViewBag.next = page + 1;
            //prev page
            ViewBag.prev = page - 1;

            return(View(allPetfood));
        }
Example #2
0
        public ActionResult Search(string keywordPet, int page = 1, int pageSize = 2)
        {
            var productView = new ProductViewHome();
            //initialize
            int totalRecord = 0;

            //Save Pet to pass data to another view
            ViewBag.viewPetSaleOff = productView.getViewPetSaleOff();
            //Get all pet
            var allPet = new PetModel().Search(keywordPet, ref totalRecord, page, pageSize);

            //Save total page, keyword and page to pass data to another view
            ViewBag.Total   = totalRecord;
            ViewBag.keyword = keywordPet;
            ViewBag.Page    = page;

            //Paging
            int maxPage   = 5;//maximum page link display on website
            int totalPage = 0;

            //Paging Algorithm
            totalPage = (int)Math.Ceiling((double)totalRecord / pageSize);

            //Save data page to pass data to another view
            ViewBag.totalPage = totalPage;
            ViewBag.maxPage   = maxPage;
            ViewBag.first     = 1;
            ViewBag.last      = totalPage;
            ViewBag.next      = page + 1;
            ViewBag.prev      = page - 1;
            return(View(allPet));
        }
        // GET: PetFood
        public ActionResult Index(int page = 1, int pageSize = 12)
        {
            var productView = new ProductViewHome();
            int totalRecord = 0;

            // get list sale off pet food
            ViewBag.viewPetFoodSaleOff = productView.getViewPetFoodSaleOff();
            var allPetfood = new PetFoodModel().getAllPetFood(ref totalRecord, page, pageSize);

            ViewBag.Total = totalRecord;
            ViewBag.Page  = page;

            int maxPage   = 5;//maximum page link display on website
            int totalPage = 0;

            //caculator total page
            totalPage = (int)Math.Ceiling((double)totalRecord / pageSize);

            ViewBag.totalPage = totalPage;
            ViewBag.maxPage   = maxPage;
            // first page
            ViewBag.first = 1;
            //last page
            ViewBag.last = totalPage;
            //next page
            ViewBag.next = page + 1;
            //prev page
            ViewBag.prev = page - 1;

            return(View(allPetfood));
        }
Example #4
0
        // GET: ProductCategory
        public ActionResult Search(string search, int page = 1, int pagesize = 20)
        {
            var model = new ProductViewHome();

            ViewBag.Search = search;
            model.Filter   = new BookModel().GetBooksAtKeyword(search, page, pagesize);
            ViewBag.Count  = model.Filter.Count();
            return(View(model));
        }
Example #5
0
        // GET: ProductCategory
        public ActionResult IDPublisingCompany(int IDPublisingCompany, int page = 1, int pagesize = 20)
        {
            var model = new ProductViewHome();

            ViewBag.Name  = "Nhà Xuất Bản :" + new PublishingCompanyModel().GetItemAtID(IDPublisingCompany).Name;
            model.Filter  = new BookModel().GetBooksAtIDPublisingCompany(IDPublisingCompany, page, pagesize);
            ViewBag.Count = model.Filter.Count();
            return(View(model));
        }
Example #6
0
        // GET: ProductCategory
        public ActionResult IDAuthor(int IDAuthor, int page = 1, int pagesize = 20)
        {
            var model = new ProductViewHome();

            ViewBag.Name  = "Tác giả :" + new AuthorModel().GetItemAtID(IDAuthor).Name;
            model.Filter  = new BookModel().GetBooksAtIDAuthor(IDAuthor, page, pagesize);
            ViewBag.Count = model.Filter.Count();
            return(View(model));
        }
Example #7
0
        // GET: ProductCategory
        public ActionResult Sale(int page = 1, int pagesize = 20)
        {
            var model = new ProductViewHome();

            ViewBag.Name  = "Sale Off %";
            model.Filter  = new BookModel().GetSale().ToPagedList(page, pagesize);
            ViewBag.Count = model.Filter.Count();
            return(View(model));
        }
Example #8
0
        // GET: ProductCategory
        public ActionResult BestSeller(int page = 1, int pagesize = 20)
        {
            var model = new ProductViewHome();

            ViewBag.Name  = "Bán Chạy Nhất";
            model.Filter  = new BookModel().GetBestseller().ToPagedList(page, pagesize);
            ViewBag.Count = model.Filter.Count();
            return(View(model));
        }
Example #9
0
        // GET: homei
        public ActionResult Index()
        {
            var model = new ProductViewHome();

            model.New        = new BookModel().GetNew().Take(3);
            model.Sale       = new BookModel().GetSale().Take(3);
            model.Bestseller = new BookModel().GetBestseller().Take(3);
            return(PartialView(model));
        }
Example #10
0
        // GET: Home
        public ActionResult Index()
        {
            var productView = new ProductViewHome();

            ViewBag.viewPet        = productView.getViewPet(4);
            ViewBag.viewPetFood    = productView.getViewPetFood(4);
            ViewBag.viewPetToy     = productView.getViewPetToys(4);
            ViewBag.viewPetSaleOff = productView.getViewPetSaleOff();
            return(View());
        }
Example #11
0
        // GET: ProductCategory
        public ActionResult Index(int IDCategory, int page = 1, int pagesize = 20)
        {
            var model = new ProductViewHome();

            ViewBag.LinkRootCategory = new CategoryModel().GetLinkRootCategory(IDCategory);
            ViewBag.Name             = new CategoryModel().GetItemAtID(IDCategory).Name;
            model.Filter             = new BookModel().GetBooksAtIDCt(IDCategory, page, pagesize);
            ViewBag.Count            = model.Filter.Count();
            return(View(model));
        }