Exemplo n.º 1
0
        public static IPagedMutable <T> ToMutable <T>(this IPaged <T> input)
        {
            var response = new PagedMutable <T>(input)
            {
                TotalCount = input.TotalCount,
                PageSize   = input.PageSize,
                PageIndex  = input.PageIndex,
                TotalPages = input.TotalPages
            };

            response.CalculatePagination();

            return(response);
        }
Exemplo n.º 2
0
        public static IPagedMutable <TOut> Convert <TIn, TOut>(this IPagedMutable <TIn> input, Func <TIn, TOut> func)
        {
            var items = new List <TOut>();

            foreach (var item in input)
            {
                items.Add(func(item));
            }

            var response = new PagedMutable <TOut>(items)
            {
                TotalCount = input.TotalCount,
                PageSize   = input.PageSize,
                PageIndex  = input.PageIndex,
                TotalPages = input.TotalPages
            };

            response.CalculatePagination();

            return(response);
        }