public List <Menu> getList(int?parentId) { Expression <Func <Menu, bool> > predicate = PredicateExtensionses.True <Menu>(); predicate = predicate.And(m => m.DeleteFlag == "N"); if (parentId != null && parentId != 0) { predicate = predicate.And(m => m.ParentId == parentId); } return(db.Menu.Where(predicate).OrderBy(m => m.OrderByNum).ToList <Menu>()); }
public List <Suggestion> getPageList(int pageSize, int pageIndex, out int total, string keywords) { Expression <Func <Suggestion, bool> > predicate = PredicateExtensionses.True <Suggestion>(); predicate = predicate.And(m => m.DeleteFlag == "N"); if (!string.IsNullOrEmpty(keywords)) { predicate = predicate.And(m => m.Title.Contains(keywords)); } total = db.Suggestion.Where(predicate).Count(); return(db.Suggestion.Where(predicate).OrderByDescending(m => m.Id).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList <Suggestion>()); }
public List <Banner> getList(string type, string status) { Expression <Func <Banner, bool> > predicate = PredicateExtensionses.True <Banner>(); predicate = predicate.And(m => m.DeleteFlag == "N"); if (!string.IsNullOrEmpty(type)) { predicate = predicate.And(m => m.Type == type); } if (!string.IsNullOrEmpty(status)) { predicate = predicate.And(m => m.Status == status); } return(db.Banner.Where(predicate).OrderBy(m => m.OrderByNum).ToList <Banner>()); }
public List <Article> getPageList(int pageSize, int pageIndex, out int total, string keywords, int menuId) { Expression <Func <Article, bool> > predicate = PredicateExtensionses.True <Article>(); predicate = predicate.And(m => m.DeleteFlag == "N"); if (!string.IsNullOrEmpty(keywords)) { predicate = predicate.And(m => m.Title.Contains(keywords)); } if (menuId != null && menuId != 0) { predicate = predicate.And(m => m.MenuId == menuId); } total = db.Article.Where(predicate).Count(); return(db.Article.Where(predicate).OrderByDescending(m => m.Id).Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList <Article>()); }