public void SetViewBag(int?selectedId = null) { //var dao = new CategoryDAO(); List <Category> lstCate = new CategoryHandle().GetListCategory();; ViewBag.IDCategory = new SelectList(lstCate, "id", "categoryName", selectedId); }
// GET: Admin/Category public ActionResult Index(int page = 1, int pagesize = 5) { var ca = new CategoryHandle(); List <Category> lstCate = ca.GetListCategory(); IEnumerable <Category> model = lstCate.OrderBy(x => x.id).ToPagedList(page, pagesize); return(View(model)); }