예제 #1
0
        public ActionResult List(PagerRequest request, PointListSearchOption search)
        {
            int totalCount;
            var data = _pointRepository.Get(e => (!search.UId.HasValue || e.User_Id == search.UId.Value)
                                                  && e.Status != (int)DataStatus.Deleted
                                                  && (!search.PSourceType.HasValue || e.PointSourceType == (int)search.PSourceType.Value)
                                                  && (!search.PSourceId.HasValue || e.PointSourceId == (int)search.PSourceId.Value)
                                                  && (!search.PType.HasValue || e.Type == (int)search.PType.Value)

                                            , 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.Name);
                                                        case GenericOrder.OrderByCreateDate:
                                                        default:
                                                            return e.OrderByDescending(o => o.CreatedDate);

                                                    }
                                                }
                                            });
            
            var vo = MappingManager.PointViewMapping(data.ToList());

            var v = new PointCollectionViewModel(request, totalCount) { Points = vo.ToList() };

            return View("List", v);
        }
예제 #2
0
 public ActionResult Index(PagerRequest request, PointListSearchOption search)
 {
     return List(request, search);
 }