public ActionResult List(PagerRequest request, BannerSearchOption search)
        {
            int totalCount;
            var linq = _bannerRepo.Get(e => (!search.PromotionId.HasValue || (e.SourceId == search.PromotionId.Value && e.SourceType == (int)SourceType.Promotion))
                                                     && (!search.Status.HasValue || e.Status == (int)search.Status.Value)
                                                     && 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.OrderByCreateDate:
                                                           default:
                                                               return e.OrderByDescending(o => o.CreatedDate);

                                                       }
                                                   }
                                               });

           var linq_All =  linq.Join(_proRepo.GetAll(),
                o => o.SourceId,
                i => i.Id,
                (o, i) => new { B = o, P = i })
                .GroupJoin(_resourceRepo.Get(r => r.SourceType == (int)SourceType.BannerPromotion),
                o => o.B.Id,
                i => i.SourceId,
                (o, i) => new { B = o.B, P = o.P, R = i.FirstOrDefault() });
            var vo = from l in linq_All.ToList()
                     select new BannerViewModel() { 
                         Id = l.B.Id,
                          SourceId = l.B.SourceId,
                          SourceType = l.B.SourceType,
                          Resource  = MappingManager.ResourceViewMapping(l.R),
                          Promotion = MappingManager.PromotionViewMapping(l.P),
                          SortOrder = l.B.SortOrder,
                           Status = l.B.Status
                     };

            var v = new BannerCollectionViewModel(request, totalCount) { Banners = vo.ToList() };
            ViewBag.SearchOptions = search;
            return View("List", v);
        }
 public ActionResult Index(PagerRequest request, BannerSearchOption search)
 {
     return List(request,search);
 }