public ActionResult Index(WorkGuideCondition condition)
        {
            var news   = service.SearchWorkGuide(condition);
            var models = new PagedList <WorkGuide>(news, news.Paging);

            return(View(PluginHelper.GetViewPath(this.GetType(), "Index"), models));
        }
Exemple #2
0
        public IPagedList <WorkGuide> SearchWorkGuide(WorkGuideCondition condition)
        {
            var query = repository.Table;

            if (!string.IsNullOrEmpty(condition.Title))
            {
                query = query.Where(t => t.Title.Contains(condition.Title));
            }
            if (condition.WorkType != null)
            {
                query = query.Where(t => t.WorkType == condition.WorkType);
            }
            query = query.Where(t => t.IsDelete == false);
            query = query.OrderByDescending(t => t.CreateDate);

            return(new PagedList <WorkGuide>(query, condition.PageIndex, condition.PageSize));
        }