예제 #1
0
        public ActionResult NewsSearchResult(string key)
        {
            int pageSize  = int.Parse(Request["pageSize"] ?? "15");
            int pageIndex = int.Parse(Request["pageIndex"] ?? "1");
            int total     = 0;
            var list      = NewsBll.GetSearchNews(pageSize, pageIndex, out total, key).Select(n => new NewsViewModel()
            {
                Id        = n.Id,
                Type      = n.Type,
                InTime    = n.InTime,
                ViewNum   = n.ViewNum,//浏览量
                EditTitle = n.EditTitle,
                Title     = n.Title,
                Msg       = n.Msg,
                MsgNum    = n.MsgNum,//留言数
                Memo      = n.Memo
            }).ToList();

            TempData["SearchTitle"]  = key;
            ViewData["SearchResult"] = list;
            ViewData["pageIndex"]    = pageIndex;
            ViewData["pageSize"]     = pageSize;
            ViewData["Total"]        = total;
            return(View());
        }