protected internal JsonResult ClientSideViewError(string error, JsonRequestBehavior behavior)
 {
     ClientSideView jsonView = new ClientSideView();
     jsonView.Error = error;
     jsonView.Success = false;
     return new JsonResult() { Data = jsonView, JsonRequestBehavior = behavior };
 }
Ejemplo n.º 2
0
 public JsonNetResult(object data, JsonRequestBehavior jsonRequestBehavior, JsonSerializerSettings settings = null)
 {
     this.ContentType = "application/json";
     this.Data = data;
     this.JsonRequestBehavior = jsonRequestBehavior;
     this.Settings = settings;
 }
Ejemplo n.º 3
0
 public JsonNetResult(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior jsonRequestBehavior)
 {
     this.ContentEncoding = contentEncoding;
     this.ContentType = !string.IsNullOrWhiteSpace(contentType) ? contentType : "application/json";
     this.Data = data;
     this.JsonRequestBehavior = jsonRequestBehavior;
 }
Ejemplo n.º 4
0
 public JsonpResult(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     Data = data;
     ContentType = contentType;
     ContentEncoding = contentEncoding;
     JsonRequestBehavior = behavior;
 }
Ejemplo n.º 5
0
        protected ActionResult JsonFormResponse(JsonRequestBehavior jsonRequestBehaviour = JsonRequestBehavior.DenyGet)
        {
            if (ModelState.IsValid)
            {
                return new HttpStatusCodeResult(200);
            }

            var errorList = new List<JsonValidationError>();
            foreach (var key in ModelState.Keys)
            {
                ModelState modelState = null;
                if (ModelState.TryGetValue(key, out modelState))
                {
                    foreach (var error in modelState.Errors)
                    {
                        errorList.Add(new JsonValidationError()
                        {
                            Key = key,
                            Message = error.ErrorMessage
                        });
                    }
                }
            }

            var response = new JsonResponse()
            {
                Type = "Validation",
                Message = "",
                Errors = errorList
            };

            Response.StatusCode = 400;
            return Json(response, jsonRequestBehaviour);
        }
Ejemplo n.º 6
0
 public static JsonResult ResultOk(object data,JsonRequestBehavior behavior = JsonRequestBehavior.DenyGet)
 {
     JsonResult result = new JsonResult();
     result.Data = new MogJsonResult() {Result = true, Data = data };
     result.JsonRequestBehavior = behavior;
     return result;
 }
		private DataTableResult(string sEcho, int iTotalRecords, int iTotalDisplayRecords)
		{
			this.JsonRequestBehavior = JsonRequestBehavior.DenyGet;
			this.sEcho = sEcho;
			this.iTotalRecords = iTotalRecords;
			this.iTotalDisplayRecords = iTotalDisplayRecords;
		}
Ejemplo n.º 8
0
 public JsonNetResult(object data, JsonRequestBehavior behavior = JsonRequestBehavior.AllowGet, string contentType = null, Encoding contentEncoding = null)
 {
     this.Data = data;
     this.JsonRequestBehavior = behavior;
     this.ContentEncoding = contentEncoding;
     this.ContentType = contentType;
 }
Ejemplo n.º 9
0
 public static JsonNetResult JsonCamelCase(this Controller controller, object data, JsonRequestBehavior jsonBehavior)
 {
     return new JsonNetResult()
     {
         Data = data,
         JsonRequestBehavior = jsonBehavior
     };
 }
 protected JsonNetResult JsonNet(object data, JsonRequestBehavior behavior = JsonRequestBehavior.DenyGet)
 {
     return new JsonNetResult
     {
         Data = data,
         JsonRequestBehavior = behavior
     };
 }
Ejemplo n.º 11
0
 protected new JsonResult Json(object data, JsonRequestBehavior behavior)
 {
     return new JsonNetResult()
     {
         Data = data,
         JsonRequestBehavior = behavior
     };
 }
Ejemplo n.º 12
0
 public JsonpResult Jsonp(object data, JsonRequestBehavior behavior)
 {
     return new JsonpResult
     {
         Data = data,
         JsonRequestBehavior = behavior
     };
 }
Ejemplo n.º 13
0
 protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return new JsonDotNetResult {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior
     };
 }
Ejemplo n.º 14
0
		protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior) {
			return new JsonResult {
				Data = data,
				ContentType = contentType,
				ContentEncoding = contentEncoding,
				JsonRequestBehavior = behavior,
				MaxJsonLength = int.MaxValue
			};
		}
Ejemplo n.º 15
0
 protected JsonResult MyJson(object data, JsonRequestBehavior behavior, string format)
 {
     return new CustomJsonResult
     {
         Data = data,
         JsonRequestBehavior = behavior,
         FormateStr = format
     };
 }
Ejemplo n.º 16
0
 protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return new ServiceStackJsonResult
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding
     };
 }
Ejemplo n.º 17
0
 public static FormatJsonResult JsonFormat(this Controller c
     , object data
     , JsonRequestBehavior behavior = JsonRequestBehavior.DenyGet)
 {
     FormatJsonResult result = new FormatJsonResult();
     result.Data = data;
     result.JsonRequestBehavior = behavior;
     return result;
 }
 protected internal virtual DirectResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior, JsonSerializerSettings settings) {
     return new DirectResult {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         Settings = settings,
         JsonRequestBehavior = behavior
     };
 }
Ejemplo n.º 19
0
 protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return new JsonResultEx
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior
     };
 }
Ejemplo n.º 20
0
 private static JsonNetResult JsonNet(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return new JsonNetResult()
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior
     };
 }
Ejemplo n.º 21
0
        protected override JsonResult Json(object data, string contentType, Encoding contentEncoding,
                                           JsonRequestBehavior behavior)
        {
            JsonResult.Data = data;
            JsonResult.ContentEncoding = contentEncoding;
            JsonResult.ContentType = contentType;
            JsonResult.JsonRequestBehavior = behavior;

            return JsonResult;
        }
Ejemplo n.º 22
0
 protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return new KuduJsonResult {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior,
         MaxJsonLength = Int32.MaxValue
     };
 }
Ejemplo n.º 23
0
 /// <summary>
 /// 返回JsonResult
 /// </summary>
 /// <param name="data">数据</param>
 /// <param name="contentType">内容类型</param>
 /// <param name="contentEncoding">内容编码</param>
 /// <param name="behavior">行为</param>
 /// <returns>JsonReuslt</returns>
 protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return Json(
         data,
         contentType,
         contentEncoding,
         behavior,
         null
     );
 }
Ejemplo n.º 24
0
 //protected internal new JsonResult Json(object data)
 //{
 //    return Json(data, null /* contentType */, null /* contentEncoding */, JsonRequestBehavior.AllowGet);
 //}
 //protected internal new JsonResult Json(object data, string contentType)
 //{
 //    return Json(data, contentType, null /* contentEncoding */, JsonRequestBehavior.AllowGet);
 //}
 //protected override JsonResult Json(object data, string contentType, Encoding contentEncoding)
 //{
 //    return Json(data, contentType, contentEncoding, JsonRequestBehavior.AllowGet);
 //}
 //protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 //{
 //    return new JsonNetResult
 //    {
 //        Data = data,
 //        ContentType = contentType,
 //        ContentEncoding = contentEncoding,
 //        JsonRequestBehavior = behavior
 //    };
 //}
 protected JsonResult JsonNet(object data, string contentType = null, Encoding contentEncoding = null, JsonRequestBehavior behavior = JsonRequestBehavior.AllowGet)
 {
     return new JsonNetResult
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior
     };
 }
 protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     KnockoutUtilities.ConvertData(data);
        return new JsonResult {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior
     };
 }
Ejemplo n.º 26
0
 public static JsonNetResult JsonNet(this Controller controller, object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return new JsonNetResult
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior
     };
 }
Ejemplo n.º 27
0
 protected override JsonResult Json( object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior )
 {
     return new CustomJsonResult
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
Ejemplo n.º 28
0
 public static JsonNetResult JsonNet(this Controller controller, object Data, string ContentType, Encoding ContentEncoding, JsonRequestBehavior JsonRequestBehavior)
 {
     return new JsonNetResult()
     {
         Data = Data,
         ContentType = ContentType,
         ContentEncoding = ContentEncoding,
         JsonRequestBehavior = JsonRequestBehavior
     };
 }
Ejemplo n.º 29
0
 protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return new CustomJsonResult
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior,
         FormateStr = "yyyy-MM-dd HH:mm:ss"
     };
 }
Ejemplo n.º 30
0
 protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return(new JsonDotNetResult {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior,
         RecursionLimit = 10
     });
 }
 protected override AbpJsonResult AbpJson(object data, string contentType = null,
                                          Encoding contentEncoding        = null, JsonRequestBehavior behavior = JsonRequestBehavior.DenyGet,
                                          bool wrapResult = true, bool camelCase = false, bool indented = false)
 {
     return(new AbpJsonResult
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior,
         MaxJsonLength = int.MaxValue,
         CamelCase = camelCase,
         Indented = indented,
     });
 }
 protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return(new MaestroJsonResult
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior
     });
 }
Ejemplo n.º 33
0
        // the method is overriden to allow for bigger amount of data to be sent : MaxJsonLength = Int32.MaxValue
        protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
        {
            //var jsonMediaTypeFormatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
            //jsonMediaTypeFormatter.SerializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.All;
            //jsonMediaTypeFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;


            return(new JsonResult()
            {
                Data = data,
                ContentType = contentType,
                ContentEncoding = contentEncoding,
                JsonRequestBehavior = behavior,
                MaxJsonLength = Int32.MaxValue
            });
        }
Ejemplo n.º 34
0
 public JsonpResult(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     Data                = data;
     ContentType         = contentType;
     ContentEncoding     = contentEncoding;
     JsonRequestBehavior = behavior;
 }
Ejemplo n.º 35
0
 protected internal JsonResult Json(object data, string contentType, JsonRequestBehavior behavior)
 {
     return(Json(data, contentType, null /* contentEncoding */, behavior));
 }
Ejemplo n.º 36
0
        /// <summary>
        /// Json the specified data, contentType, contentEncoding and behavior.
        /// </summary>
        /// <param name="data">Data.</param>
        /// <param name="contentType">Content type.</param>
        /// <param name="contentEncoding">Content encoding.</param>
        /// <param name="behavior">Behavior.</param>
        protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
        {
            if (data == null)
            {
                data = new AjaxResponse();
            }
            else if (!ReflectionHelper.IsAssignableToGenericType(data.GetType(), typeof(AjaxResponse <>)))
            {
                data = new AjaxResponse(data);
            }

            return(new AbpJsonResult
            {
                Data = data,
                ContentType = contentType,
                ContentEncoding = contentEncoding,
                JsonRequestBehavior = behavior
            });
        }
Ejemplo n.º 37
0
 public CustomActionResult(object data, JsonRequestBehavior jsonRequestBehavior)
 {
     Data = data;
     JsonRequestBehavior = jsonRequestBehavior;
 }
Ejemplo n.º 38
0
 protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return(Json(data, contentType, contentEncoding, behavior, null));
 }
Ejemplo n.º 39
0
 protected internal virtual DirectResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior, JsonSerializerSettings settings)
 {
     return(new DirectResult {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         Settings = settings,
         JsonRequestBehavior = behavior
     });
 }
Ejemplo n.º 40
0
 protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return(new JsonResult()
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior,
         MaxJsonLength = Int32.MaxValue
     });
 }
Ejemplo n.º 41
0
 protected /*override*/ JsonResult Json2(object data, /*string contentType, Encoding contentEncoding,*/ JsonRequestBehavior behavior)
 {
     return(new JsonResult()
     {
         Data = data,
         //ContentType = contentType,
         //ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior,
         MaxJsonLength = Int32.MaxValue
     });
 }
Ejemplo n.º 42
0
 protected StandardJsonResult <T> JsonSuccess <T>(T data, JsonRequestBehavior behavior = JsonRequestBehavior.DenyGet)
 {
     return(new StandardJsonResult <T> {
         Data = data, JsonRequestBehavior = behavior
     });
 }
Ejemplo n.º 43
0
        protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
        {
            var k = new CustomJsonResult();

            k.Data                = data;
            k.ContentType         = contentType;
            k.ContentEncoding     = contentEncoding;
            k.JsonRequestBehavior = behavior;

            return(k);
        }
Ejemplo n.º 44
0
        /// <summary>
        /// Json the specified data, contentType, contentEncoding and behavior.
        /// </summary>
        /// <param name="data">Data.</param>
        /// <param name="contentType">Content type.</param>
        /// <param name="contentEncoding">Content encoding.</param>
        /// <param name="behavior">Behavior.</param>
        protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
        {
            if (_wrapResultAttribute != null && !_wrapResultAttribute.WrapOnSuccess)
            {
                return(base.Json(data, contentType, contentEncoding, behavior));
            }

            if (data == null)
            {
                data = new AjaxResponse();
            }
            else if (!ReflectionHelper.IsAssignableToGenericType(data.GetType(), typeof(AjaxResponse <>)))
            {
                data = new AjaxResponse(data);
            }

            return(new AbpJsonResult
            {
                Data = data,
                ContentType = contentType,
                ContentEncoding = contentEncoding,
                JsonRequestBehavior = behavior
            });
        }
Ejemplo n.º 45
0
        /// <summary>
        /// Json the specified data, contentType, contentEncoding and behavior.
        /// </summary>
        /// <param name="data">Data.</param>
        /// <param name="contentType">Content type.</param>
        /// <param name="contentEncoding">Content encoding.</param>
        /// <param name="behavior">Behavior.</param>
        protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
        {
            if (_wrapResultAttribute != null && !_wrapResultAttribute.WrapOnSuccess)
            {
                return(base.Json(data, contentType, contentEncoding, behavior));
            }

            return(Json(data, contentType, contentEncoding, behavior));
        }
Ejemplo n.º 46
0
 protected ActionResult DataGrid <T>(int total, List <T> lstEntities, JsonRequestBehavior jsonRequestBehavior = JsonRequestBehavior.AllowGet)
 {
     return(Json(new DataGridModel <T>(total, lstEntities).ToDataObject(), jsonRequestBehavior));
 }
Ejemplo n.º 47
0
 public JsonRequestBehaviorAttribute()
 {
     Behavior = JsonRequestBehavior.AllowGet;
 }
Ejemplo n.º 48
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 /// <param name="data">Data to parse.</param>
 /// <param name="behavior">Behavior</param>
 public JsonDataTableResult(Object data, JsonRequestBehavior behavior)
 {
     Data     = data;
     Behavior = behavior;
 }
Ejemplo n.º 49
0
 protected internal virtual JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return(new JsonResult
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior
     });
 }
Ejemplo n.º 50
0
 public JsonExtendResult(object data, JsonRequestBehavior behavior, string dateFmt, int decimalPlaces) : this(data, behavior)
 {
     this._dateFmt       = dateFmt;
     this._decimalPlaces = decimalPlaces;
 }
Ejemplo n.º 51
0
        protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
        {
            if (behavior == JsonRequestBehavior.DenyGet && string.Equals(this.Request.HttpMethod, "GET", StringComparison.OrdinalIgnoreCase))
            {
                return(new JsonResult());
            }

            return(new JsonNetResult
            {
                Data = data,
                ContentType = contentType,
                ContentEncoding = contentEncoding
            });
        }
Ejemplo n.º 52
0
 public JsonExtendResult(object data, JsonRequestBehavior behavior, string dateFmt) : this(data, behavior)
 {
     this._dateFmt = dateFmt;
 }
Ejemplo n.º 53
0
 public JsonCamelCaseResult(object data, JsonRequestBehavior jsonRequestBehavior)
 {
     Data = data;
     JsonRequestBehavior = jsonRequestBehavior;
 }
Ejemplo n.º 54
0
 public JsonExtendResult(object data, JsonRequestBehavior behavior)
 {
     base.Data = data;
     base.JsonRequestBehavior = behavior;
 }
Ejemplo n.º 55
0
 protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return(new CustomJsonResult
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior,
         FormateStr = "yyyy-MM-dd HH:mm:ss"
     });
 }
Ejemplo n.º 56
0
 protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return(new BetterJsonResult(data)
     {
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior,
     });
 }
Ejemplo n.º 57
0
 protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return(base.Json(data, "text/plain", contentEncoding, behavior));
 }
Ejemplo n.º 58
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="data">Object that needs to be serialized into JSON</param>
 /// <param name="behavior">The Content-Type (MIME)</param>
 public DataResult(IQueryable <Object> data, JsonRequestBehavior behavior)
 {
     base.Data = data; base.JsonRequestBehavior = behavior; _data = data;
 }
Ejemplo n.º 59
0
 protected override JsonResult Json(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
 {
     return(new JsonNetResult
     {
         Data = data,
         ContentType = contentType,
         ContentEncoding = contentEncoding,
         JsonRequestBehavior = behavior
     });
 }
Ejemplo n.º 60
-25
        protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding, JsonRequestBehavior behavior)
        {
            // TODO: change all my GET Json request into POST
            /*return base.Json(data, contentType, contentEncoding,
                JsonRequestBehavior.AllowGet);*/
            return new JsonNetResult(data, contentType, contentEncoding, JsonRequestBehavior.AllowGet);

        }