Example #1
0
        /// <summary>
        /// 普通序列化(不进行UI友好的json化)
        /// </summary>
        /// <param name="c">控制器</param>
        /// <param name="data">数据</param>
        /// <returns></returns>
        public static FormatJsonResult JsonFormat(this Controller c, object data)
        {
            FormatJsonResult result = new FormatJsonResult();

            result.NotLigerUIFriendlySerialize = true;
            result.Data = data;
            return(result);
        }
Example #2
0
        /// <summary>
        /// UI友好的json格式序列化
        /// </summary>
        /// <param name="c"></param>
        /// <param name="data"></param>
        /// <param name="IsError"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static FormatJsonResult JsonFormat(this Controller c, object data, bool IsCorrect, string message, bool IsLink = false, string code = "")
        {
            FormatJsonResult result = new FormatJsonResult();

            result.IsLink  = IsLink;
            result.Data    = data;
            result.Message = message;
            result.IsError = !IsCorrect;
            result.Code    = code;
            return(result);
        }