Пример #1
0
        /// <summary>
        /// 组合lay表格数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list"></param>
        /// <returns></returns>
        public static string ToTableJson <T>(List <T> list, string msg)
        {
            var json = new LayerTableJson
            {
                data  = list,
                code  = 0,
                count = list.Count(),
                msg   = msg
            };
            var res = JsonConvert.SerializeObject(json);

            return(res);
        }
Пример #2
0
        /// <summary>
        /// 组合lay表格数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="list"></param>
        /// <returns></returns>
        public static string ToTableJson <T>(List <T> list, int count = 0)
        {
            var json = new LayerTableJson

            {
                data  = list,
                code  = 0,
                count = count == 0 ? list == null? 0 : list.Count():count,
                msg   = "成功"
            };
            var res = JsonConvert.SerializeObject(json);

            return(res);
        }