public ActionResult Index(MessageOpenNormativeFileCondition condition) { var info = service.SearchNews(condition); var models = new PagedList <MessageOpenNormativeFileInfo>(info, info.Paging); return(View(PluginHelper.GetViewPath(this.GetType(), "Index"), models)); }
public IPagedList <MessageOpenNormativeFileInfo> SearchNews(MessageOpenNormativeFileCondition 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 <MessageOpenNormativeFileInfo>(query, condition.PageIndex, condition.PageSize)); }