public ActionResult Index(MapMessageCondition condition) { var activity = service.SearchNews(condition); var models = new PagedList <MapMessageInfo>(activity, activity.Paging); return(View(PluginHelper.GetViewPath(this.GetType(), "Index"), models)); }
public IPagedList <MapMessageInfo> SearchNews(MapMessageCondition condition) { var query = repository.Table; if (!string.IsNullOrEmpty(condition.Name)) { query = query.Where(t => t.Name.Contains(condition.Name)); } if (condition.SortModual != null) { query = query.Where(t => t.SortModual == condition.SortModual); } query = query.Where(t => t.IsDelete == false); query = query.OrderByDescending(t => t.CreateDate); return(new PagedList <MapMessageInfo>(query, condition.PageIndex, condition.PageSize)); }