Ejemplo n.º 1
0
        /// <summary>
        /// 返回规则类(带分页)
        /// </summary>
        public static ResultModelPager <T> SetResult <T>(this string MsgStr, T ResultObj, int Count)
        {
            ResultModelPager <T> result = new ResultModelPager <T>();

            if (ResultObj == null)
            {
                result.Ret = 0;
            }
            else
            {
                result.Ret = 1;
            }
            result.Message = MsgStr;
            result.rows    = ResultObj;
            result.records = Count;
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 返回规则类(带分页)2
        /// </summary>
        public static ResultModelPager <T> SetResultPager <T>(this string MsgStr, T ResultObj, int Count = 0, int Page = 0, int Size = 0)
        {
            ResultModelPager <T> result = new ResultModelPager <T>();

            if (ResultObj == null)
            {
                result.Ret = 0;
            }
            else
            {
                result.Ret     = 1;
                result.records = Count;
                result.total   = Convert.ToInt32(Count % Size == 0 ? Count / Size : Count / Size + 1);
                result.page    = Page;
            }
            result.Message = MsgStr;
            result.rows    = ResultObj;
            return(result);
        }