/// <summary> /// UI友好的json格式序列化 /// </summary> /// <param name="c"></param> /// <param name="data"></param> /// <param name="success"></param> /// <param name="message"></param> /// <returns></returns> public static FormatJsonResult JsonFormat(this Controller c, Object data, Boolean success, String message, String callbackName = "") { FormatJsonResult result = new FormatJsonResult(); result.data = data; result.msg = message; result.success = success; result.callbackName = callbackName; return(result); }
/// <summary> /// 普通序列化(不进行UI友好的json化) /// </summary> /// <param name="c">控制器</param> /// <param name="data">数据</param> /// <returns></returns> public static FormatJsonResult JsonFormat(this Controller c, Object data, String callbackName = "") { FormatJsonResult result = new FormatJsonResult(); result.NotUIFriendlySerialize = true; result.data = data; Boolean status = false; if (!data.IsNullOrEmpty()) { status = true; } result.success = status; result.callbackName = callbackName; return(result); }
/// <summary> /// 普通序列化(不进行UI友好的json化) /// </summary> /// <param name="c">控制器</param> /// <param name="data">数据</param> /// <returns></returns> public static FormatJsonResult JsonFormat(this Controller c, OperationResult or) { FormatJsonResult result = new FormatJsonResult(); result.NotUIFriendlySerialize = false; result.data = or.AppendData; result.msg = or.Message; result.callbackName = ""; result.success = false; if (or.ResultType.Equals(OperationResultType.Success)) { result.success = true; } else { result.data = or; } return(result); }