示例#1
0
        public ActionResult Index(int?page, string search, int?menuType)
        {
            var menus = menusHandler.All();

            //filter
            if (menuType != null && menuType != 0)
            {
                menus = menus.Where(m => m.menuType_id == menuType);
            }

            List <MenuTypes> menuTypes = new MenuTypesRepository().All().ToList();

            menuTypes.Insert(0, new MenuTypes {
                id = 0, title = "All"
            });
            ViewBag.MenuType = new SelectList(menuTypes, "id", "title");

            //serch
            menus = menusHandler.Search(menus, search);

            int pageSize   = PagingSettings.PageSizeInMenu;
            int pageNumber = (page ?? 1);

            return(View(menus.ToPagedList(pageNumber, pageSize)));
        }