本文整理汇总了C#中JsonRequestBehavior类的典型用法代码示例。如果您正苦于以下问题:C# JsonRequestBehavior类的具体用法?C# JsonRequestBehavior怎么用?C# JsonRequestBehavior使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JsonRequestBehavior类属于命名空间,在下文中一共展示了JsonRequestBehavior类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClientSideViewError
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 };
}
示例2: JsonNetResult
public JsonNetResult(object data, JsonRequestBehavior jsonRequestBehavior, JsonSerializerSettings settings = null)
{
this.ContentType = "application/json";
this.Data = data;
this.JsonRequestBehavior = jsonRequestBehavior;
this.Settings = settings;
}
示例3: ResultOk
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;
}
示例4: JsonpResult
public JsonpResult(object data, string contentType, Encoding contentEncoding, JsonRequestBehavior behavior)
{
Data = data;
ContentType = contentType;
ContentEncoding = contentEncoding;
JsonRequestBehavior = behavior;
}
示例5: JsonFormResponse
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);
}
示例6: JsonNetResult
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;
}
示例7: DataTableResult
private DataTableResult(string sEcho, int iTotalRecords, int iTotalDisplayRecords)
{
this.JsonRequestBehavior = JsonRequestBehavior.DenyGet;
this.sEcho = sEcho;
this.iTotalRecords = iTotalRecords;
this.iTotalDisplayRecords = iTotalDisplayRecords;
}
示例8: JsonNetResult
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;
}
示例9: JsonCamelCase
public static JsonNetResult JsonCamelCase(this Controller controller, object data, JsonRequestBehavior jsonBehavior)
{
return new JsonNetResult()
{
Data = data,
JsonRequestBehavior = jsonBehavior
};
}
示例10: JsonNet
protected JsonNetResult JsonNet(object data, JsonRequestBehavior behavior = JsonRequestBehavior.DenyGet)
{
return new JsonNetResult
{
Data = data,
JsonRequestBehavior = behavior
};
}
示例11: Json
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);
}
示例12: Json
protected new JsonResult Json(object data, JsonRequestBehavior behavior)
{
return new JsonNetResult()
{
Data = data,
JsonRequestBehavior = behavior
};
}
示例13: Jsonp
public JsonpResult Jsonp(object data, JsonRequestBehavior behavior)
{
return new JsonpResult
{
Data = data,
JsonRequestBehavior = behavior
};
}
示例14: MyJson
protected JsonResult MyJson(object data, JsonRequestBehavior behavior, string format)
{
return new CustomJsonResult
{
Data = data,
JsonRequestBehavior = behavior,
FormateStr = format
};
}
示例15: Json
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
};
}