//
        // GET: /Platform/SysHelp/
        public ActionResult Index(string keyword, string ordering, int pageIndex = 1)
        {
            var model = _sysHelp.GetAllEnt();

            var returnModel = model.Select(a => new { a.Title, a.Sort, a.CreatedDate, a.Remark, a.Id }).Search(keyword);

            if (!string.IsNullOrEmpty(ordering))
            {
                model = model.OrderBy(ordering, null);
            }

            if (!string.IsNullOrEmpty(Request["report"]))
            {
                //导出
                // var reportModel = model.Select(a => new { a.Title, a.Content, a.Sort, a.CreatedDate, a.Remark });

                //导出数据自定义字段

                var reportModel = model.Select("new ( Title,Content,Sort,CreatedDate,Remark )");

                return(new ReportResult(new Report(reportModel.ToReportSource())));
            }

            return(View(returnModel.ToPagedList(pageIndex)));
        }
Ejemplo n.º 2
0
        //
        // GET: /Admin/Desktop/

        public ActionResult Index(string keyword)
        {
            IQueryable <SysHelp> model = _iSysHelpService.GetAllEnt();

            if (!string.IsNullOrEmpty(keyword))
            {
                model = model.Where(a => a.Title.Contains(keyword) || a.Content.Contains(keyword));
            }

            return(View(model));
        }