/// <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))); }
public Response(ErrCodeEnum err, string msg = null) { ResultCode = err; ResultMessage = err.ToDescription(); if (!msg.IsNullOrEmpty()) { ResultMessage = msg; } }
/// <summary> /// 获取错误的返回 /// </summary> protected JsonResult ErrorJsonResult(ErrCodeEnum code) { var errResponse = new ResponseContext <object>(null) { Head = new ResponseHead(-1, code, code.ToDescription()) }; return(new JsonResult(errResponse)); }
public ResponseContext(ErrCodeEnum codeEnum, T data, string msg = null) { ResultCode = codeEnum; ResultMessage = codeEnum.ToDescription(); Data = data; if (!msg.IsNullOrEmpty()) { ResultMessage = msg; } }
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; } }
public ResponseContext(ErrCodeEnum codeEnum) { ResultCode = codeEnum; ResultMessage = codeEnum.ToDescription(); Data = default; }