public static string GetDescription(MenuListType type) { switch (type) { case MenuListType.Top: return("Menu trên"); case MenuListType.Bottom: return("Menu dưới"); case MenuListType.Left: return("Menu trái"); case MenuListType.Right: return("Menu phải"); case MenuListType.FooterLeft: return("Thông tin"); case MenuListType.FooterRight: return("Liên hệ"); default: return(""); } }
public IList <Menu> GetList(MenuListType type, int pageIndex, int pageSize, out int total) { var qr = Query.Where(p => p.Position == type); total = qr.Count(); qr = qr.OrderByDescending(p => p.CreatedDate); return(qr.Skip(pageIndex * pageSize).Take(pageSize).ToList()); }
public ActionResult Index(int?page, MenuListType type = MenuListType.Top) { MenusModels model = new MenusModels(); int total = 0; int PageSize = 10; int CurrentPageIndex = page.HasValue ? page.Value - 1 : 0; IList <Menu> lst = menuBarSrv.GetList(type, CurrentPageIndex, PageSize, out total); model.Type = type; model.PageListMenus = new PagedList <Menu>(lst, CurrentPageIndex, PageSize, total); return(View(model)); }