示例#1
0
 public static PagedListDto <T> ToPagedListDto <T>(this IPagedList <T> pagedList)
 {
     return(new PagedListDto <T>
     {
         Items = pagedList.AsEnumerable(),
         Metadata = pagedList.GetMetaData()
     });
 }
 /// <summary>
 ///     Map the items in a paged list
 /// </summary>
 public static IPagedList <TResult> Select <TSource, TResult>(this IPagedList <TSource> source, Func <TSource, TResult> selector)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     if (selector == null)
     {
         throw new ArgumentNullException("selector");
     }
     return(new StaticPagedList <TResult>(source.AsEnumerable().Select(selector), source.PageNumber, source.PageSize, source.TotalItemCount));
 }
示例#3
0
        public IEnumerable <CNhanVienModel> getDSPCCV(IPagedList <NhanVien> ds)
        {
            var i     = ds.FirstItemOnPage;
            var query = (from nv in ds.AsEnumerable()
                         join vt in tc.getDSVaiTro() on nv.VaiTroID equals vt.IDVaiTro into val
                         from vt in val.DefaultIfEmpty()
                         select new CNhanVienModel
            {
                STT = i++,
                MaNhanVien = nv.MaNhanVien,
                HoTen = nv.HoTen,
                VaiTroID = nv.VaiTroID,
                VaiTro = vt == null ? "" : vt.TenVaiTro,
            });

            return(query);
        }
示例#4
0
        public IPagedList <TDestination> Map <TDestination>(IPagedList <TSource> source)
        {
            var destinations = Mapper.Map <IEnumerable <TDestination> >(source.AsEnumerable());

            return(destinations.ToPagedList(source.AsPagination()));
        }