(精華)2020年6月26日 C#類庫model PageInput

愚公搬程式碼發表於2020-06-26
namespace Coldairarrow.Util
{
    /// <summary>
    /// 分頁查詢基類
    /// </summary>
    public class PageInput
    {
        private string _sortType { get; set; } = "asc";

        /// <summary>
        /// 當前頁碼
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每頁行數
        /// </summary>
        public int PageRows { get; set; } = int.MaxValue;

        /// <summary>
        /// 排序列
        /// </summary>
        public string SortField { get; set; } = "Id";

        /// <summary>
        /// 排序型別
        /// </summary>
        public string SortType { get => _sortType; set => _sortType = (value ?? string.Empty).ToLower().Contains("desc") ? "desc" : "asc"; }
    }
}

相關文章