コード例 #1
0
        public void SetViewBag(int?selectedId = null)
        {
            //var dao = new CategoryDAO();
            List <Category> lstCate = new CategoryHandle().GetListCategory();;

            ViewBag.IDCategory = new SelectList(lstCate, "id", "categoryName", selectedId);
        }
コード例 #2
0
        // 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));
        }