public ActionResult Category(long cateId,int page=1, int pageSize=1)
        {
            var category = new CategoryDao().ViewDetail(cateId);
            ViewBag.Category = category;
            int totalRecord = 0;
            var model = new ProductDao().ListByCategoryId(cateId,ref totalRecord, page, pageSize);

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

            int maxPage = 5;
            int totalPage = 0;

            totalPage = (int)Math.Ceiling((double)(totalRecord/pageSize));
            ViewBag.TotalPage = totalPage;
            ViewBag.MaxPage = maxPage;
            ViewBag.First = 1;
            ViewBag.Last = totalPage;
            ViewBag.Next = page + 1;
            ViewBag.Prev = page - 1;

            return View(model);
        }
 public PartialViewResult _BlockCategoryProduct(long CatId)
 {
     CategoryBlogViewModel model = new CategoryDao().CategoryBlog(CatId);
     return PartialView(model);
 }
Esempio n. 3
0
        public void SetViewBagBrand(long?seletedID = null)
        {
            var dao = new Model.Dao.CategoryDao();

            ViewBag.Category_ID = new SelectList(dao.ListCategory(), "ID", "Name", seletedID);
        }
 public void SetViewBag(long? selectedId = null)
 {
     var dao = new CategoryDao();
     ViewBag.CategoryId = new SelectList(dao.ListAll(),"ID","Name", selectedId);
 }
Esempio n. 5
0
        public IEnumerable <Category> ListAll()
        {
            var dao = new CategoryDao();

            return(dao.context.Categories.Where(x => x.Status == true));
        }