示例#1
0
        /// <summary>
        /// 获取错误的返回
        /// </summary>
        protected JsonResult ErrorJsonResult(ErrCodeEnum code, string title = null, Exception ex = null)
        {
            if (!string.IsNullOrEmpty(title) || ex != null)
            {
                LogHelper.ErrorAsync(title, code.ToDescription(), ex);
            }

            return(new JsonResult(new ResponseContext <object>(false, code, null)));
        }
示例#2
0
 public Response(ErrCodeEnum err, string msg = null)
 {
     ResultCode    = err;
     ResultMessage = err.ToDescription();
     if (!msg.IsNullOrEmpty())
     {
         ResultMessage = msg;
     }
 }
示例#3
0
        /// <summary>
        /// 获取错误的返回
        /// </summary>
        protected JsonResult ErrorJsonResult(ErrCodeEnum code)
        {
            var errResponse = new ResponseContext <object>(null)
            {
                Head = new ResponseHead(-1, code, code.ToDescription())
            };

            return(new JsonResult(errResponse));
        }
示例#4
0
 public ResponseContext(ErrCodeEnum codeEnum, T data, string msg = null)
 {
     ResultCode    = codeEnum;
     ResultMessage = codeEnum.ToDescription();
     Data          = data;
     if (!msg.IsNullOrEmpty())
     {
         ResultMessage = msg;
     }
 }
示例#5
0
 public ResponseContext(bool success, ErrCodeEnum err, T data, string msg = null)
 {
     Success       = success;
     Code          = err;
     ResultMessage = err.ToDescription();
     Content       = data;
     if (!msg.IsNullOrEmpty())
     {
         ResultMessage = msg;
     }
 }
示例#6
0
 public ResponseContext(ErrCodeEnum codeEnum)
 {
     ResultCode    = codeEnum;
     ResultMessage = codeEnum.ToDescription();
     Data          = default;
 }