示例#1
0
 private void Init(object data, bool success, JsonSerializerSettings serializerSettings)
 {
     result = new ApiResultJson
     {
         Result  = data,
         Success = success,
     };
     jsonResult = serializerSettings == null ? new JsonResult(result) : new JsonResult(result, serializerSettings);
 }
示例#2
0
        public static ApiResult Error(string content = "", string title = "")
        {
            Notification[] notifications = null;
            if (new[] { content, title }.Any(a => !string.IsNullOrEmpty(a)))
            {
                notifications = new[] { new Notification {
                                            Content = content, Title = title, Type = NotificationType.Error
                                        } };
            }
            ApiResultJson result = new ApiResultJson
            {
                Success       = false,
                Notifications = notifications,
            };
            var jsonResult = new JsonResult(result);

            return(new ApiResult(jsonResult, result));
        }
示例#3
0
 private ApiResult(JsonResult jsonResult, ApiResultJson result)
 {
     this.jsonResult = jsonResult;
     this.result     = result;
 }