public ActionResult Category(long cateId, int page = 1) { var category = new MoProductCategoryController().ViewDetail(cateId); ViewBag.Category = category; int totalRecord = 0; int pageSize = 12; var model = new MoProductController().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 Menu() { var model = new MoProductCategoryController().ListAll(); return(PartialView(model)); }
public void SetViewBag(long?selectedID = null) { var productcategoryController = new MoProductCategoryController(); ViewBag.CategoryID = new SelectList(productcategoryController.ListAll(), "ID", "Name", selectedID); }