protected Task <TResponse <T> > NotFound <T>(Error error, params string[] message) { var res = new TResponse <T>(default(T), true, string.Format(error.ErrorCode, message), error.ErrorCode); SerilogHelper.GetLogger() ?.Error(res.ToJson()); return(Task.FromResult(res)); }
/// <summary> /// Fail /// </summary> /// <typeparam name="T"></typeparam> /// <param name="message"></param> /// <param name="errorCode"></param> /// <returns></returns> protected Task <TResponse <T> > Fail <T>(string message, string errorCode) { var res = new TResponse <T>(default(T), false, message, errorCode); SerilogHelper.GetLogger() ?.Error(res.ToJson()); return(Task.FromResult(res)); }
/// <summary> /// Exception /// </summary> /// <typeparam name="T"></typeparam> /// <param name="ex"></param> /// <param name="sql"></param> /// <returns></returns> protected Task <TResponse <T> > Exception <T>(Exception ex, string sql = "", string data = "") { var res = new TResponse <T>(default(T), false, string.Format(_errorResourceSettings.InternalException500() .Message, ex), _errorResourceSettings.InternalException500() .ErrorCode); SerilogHelper.GetLogger() ?.Error(sql + "======" + data + "=======" + res.ToJson()); return(Task.FromResult(res)); }
/// <summary> /// Ok /// </summary> /// <typeparam name="T"></typeparam> /// <param name="data"></param> /// <returns></returns> protected Task <TResponse <T> > Ok <T>(TResponse <T> data) { return(Task.FromResult(data)); }