Exemplo n.º 1
0
        // GET: Search
        public ActionResult Index(int page = 1, int pageSize = 9)
        {
            int totalRecord = 0;
            //get content menu
            SearchTypeDao dao = new SearchTypeDao();

            ViewBag.Category        = dao.GetCategories();
            ViewBag.Color           = dao.GetColors();
            ViewBag.ProductCategory = dao.GetProductCategories();
            ViewBag.Size            = dao.GetVs();

            //search product
            List <Product> list = GetProducts(page, pageSize, ref totalRecord);

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

            ViewBag.MaxPage   = 5;
            ViewBag.totalPage = total;
            ViewBag.page      = page;
            ViewBag.First     = 1;
            ViewBag.next      = page + 1;
            ViewBag.prev      = page - 1;


            return(View(list));
        }
Exemplo n.º 2
0
        public ActionResult Detail(int id)
        {
            SearchTypeDao dao  = new SearchTypeDao();
            Product       list = new ProductDao().getOneById(id);

            ViewBag.Category = dao.getBrandByID(list.CategoryID);
            ViewBag.Style    = dao.GetProductCategoryByID(list.TypeID);
            ViewBag.Color    = dao.GetColorByID(list.Color);
            return(View(list));
        }