public IPagedList <MessageOpenAdministrativePunishInfo> SearchNews(MessageOpenAdministrativePunishCondition condition) { var query = repository.Table; if (!string.IsNullOrEmpty(condition.Title)) { query = query.Where(t => t.Title.Contains(condition.Title)); } if (condition.Title != null) { query = query.Where(t => t.Title == condition.Title); } if (condition.IsTop != null) { bool IsTop = bool.Parse(DataDictionaryHelper.GetValue((Guid)condition.IsTop)); query = query.Where(t => t.IsTop == IsTop); } if (condition.Department != null) { query = query.Where(t => t.Department.Contains(condition.Department)); } query = query.Where(t => t.IsDelete == false); query = query.OrderByDescending(t => t.IsTop).ThenByDescending(t => t.CreateDate); return(new PagedList <MessageOpenAdministrativePunishInfo>(query, condition.PageIndex, condition.PageSize)); }
public ActionResult Index(MessageOpenAdministrativePunishCondition condition) { var info = service.SearchNews(condition); var models = new PagedList <MessageOpenAdministrativePunishInfo>(info, info.Paging); return(View(PluginHelper.GetViewPath(this.GetType(), "Index"), models)); }