zhaolei
2020-11-20 4a2e5b9a21940f11757be37d99f0944e240e908b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using Bootstrap.Admin.Pages.Components;
using PetaPoco;
 
namespace Bootstrap.Admin.Pages.Extensions
{
    /// <summary>
    /// Pages 扩展操作类
    /// </summary>
    public static class PagesExtensions
    {
        /// <summary>
        /// Pages 转化为 QueryData 实例方法
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="pages"></param>
        /// <returns></returns>
        public static QueryData<T> ToQueryData<T>(this Page<T> pages)
        {
            return new QueryData<T>()
            {
                Items = pages.Items,
                PageIndex = (int)pages.CurrentPage,
                PageItems = (int)pages.ItemsPerPage,
                TotalCount = (int)pages.TotalItems,
            };
        }
    }
}