Esempio n. 1
0
 public static JsonResponse CreateError(JsonResponseStatus status)
 {
     return(new JsonResponse
     {
         Status = status,
         Errors = new List <JsonResponseStatus>()
     });
 }
Esempio n. 2
0
 public static JsonResponse CreateError(string message = null)
 {
     return(new JsonResponse
     {
         Status = JsonResponseStatus.CreateError(message),
         Errors = new List <JsonResponseStatus>()
     });
 }
Esempio n. 3
0
 public static JsonResponse CreateError(object data, JsonResponseStatus status)
 {
     return(new JsonResponse
     {
         Status = status,
         Data = data,
         Errors = new List <JsonResponseStatus>()
     });
 }
Esempio n. 4
0
 public static JsonResponse CreateSuccess(object data, string message = null)
 {
     return(new JsonResponse
     {
         Status = JsonResponseStatus.CreateSuccess(message),
         Data = data,
         Errors = new List <JsonResponseStatus>()
     });
 }
Esempio n. 5
0
        public static JsonResponse CreateError(Exception exception)
        {
            var mes = ExceptionDictionary.Instance.GetUserFriendlyMessage(exception);

            if (exception is ValidationException)
            {
                return(new JsonResponse
                {
                    Status = JsonResponseStatus.CreateError(mes),
                    Errors = (exception as ValidationException).Filds
                });
            }

            return(new JsonResponse
            {
                Status = JsonResponseStatus.CreateError(mes),
                Errors = new List <JsonResponseStatus>()
            });
        }
Esempio n. 6
0
 public JsonResponse()
 {
     Status = new JsonResponseStatus();
     Errors = new List <JsonResponseStatus>();
 }