/// <summary>
        /// 获取公共返回消息
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="status">状态</param>
        /// <param name="message">消息</param>
        /// <returns></returns>
        protected virtual BaseJsonResult <T> GetBaseJsonResult <T>(GlobalErrorCodes status = GlobalErrorCodes.Error, string message = "") where T : class
        {
            message = status == GlobalErrorCodes.Success
                ? status.GetEnumDescription()
                : string.Format("{0}{1}", status.GetEnumDescription(), string.IsNullOrEmpty(message) ? "" : "," + message);
            BaseJsonResult <T> resultMsg = new BaseJsonResult <T>
            {
                Status  = status,
                Message = message
            };

            return(resultMsg);
        }
Beispiel #2
0
        /// <summary>
        /// 获取公共返回消息
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="data">数据</param>
        /// <param name="status">状态</param>
        /// <param name="message">消息</param>
        /// <returns></returns>
        protected virtual BaseSoapResult <string> GetBaseSoapResult <T>(T data = default(T), GlobalErrorCodes status = GlobalErrorCodes.Error, string message = "") where T : class
        {
            message = string.Format("{0}{1}", status.GetEnumDescription(), string.IsNullOrEmpty(message) ? "" : "," + message);
            BaseSoapResult <string> resultMsg = new BaseSoapResult <string>
            {
                Status = status,
                Msg    = message,
                Data   = data == null ? "" : data.TryToJson()
            };

            return(resultMsg);
        }