Пример #1
0
        public ActionResult List(PagerRequest request,HotwordSearchOption search)
        {
            int totalCount;
            var data = _hotwordRepo.Get(e => (!search.Type.HasValue || e.Type == search.Type.Value)
                                               && (string.IsNullOrEmpty(search.Word) || e.Word.Contains(search.Word))
                                               && e.Status != (int)DataStatus.Deleted
                                             , out totalCount
                                             , request.PageIndex
                                             , request.PageSize
                                             , e =>
                                             {
                                                 if (!search.OrderBy.HasValue)
                                                     return e.OrderByDescending(o => o.CreatedDate);
                                                 else
                                                 {
                                                     switch (search.OrderBy.Value)
                                                     {
                                                         case GenericOrder.OrderByCreateUser:
                                                             return e.OrderByDescending(o => o.CreatedUser);
                                                         case GenericOrder.OrderByName:
                                                             return e.OrderByDescending(o => o.Word);
                                                         case GenericOrder.OrderByCreateDate:
                                                         default:
                                                             return e.OrderByDescending(o => o.CreatedDate);

                                                     }
                                                 }
                                                
                                             });

            var models = from d in data.ToList()
                         select new HotwordViewModel().FromEntity<HotwordViewModel>(d);

            return View("List", new Pager<HotwordViewModel>(request, totalCount) { Data=models});
        }
Пример #2
0
 public ActionResult Index(PagerRequest request,HotwordSearchOption search)
 {
     return List(request,search);
 }