public override bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) { BindModelOnSuccessOrFail(bindingContext, () => ModelBinderUtils.CreateArgumentMap(DeserializeJsonContent(actionContext)), ModelBinderUtils.CreateArgumentMapForMalformedArgs); return(true); }
public override bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) { BindModelOnSuccessOrFail(bindingContext, () => ModelBinderUtils.CreateReservedArguments(actionContext.Request.RequestUri.Query), ModelBinderUtils.CreateReservedArgumentsForMalformedArgs); return(true); }
public override bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) { BindModelOnSuccessOrFail(bindingContext, () => ModelBinderUtils.CreateSingleValueArgument(DeserializeQueryString(actionContext)), ModelBinderUtils.CreateSingleValueArgumentForMalformedArgs); return(true); }
public override bool BindModel(HttpActionContext actionContext, ModelBindingContext bindingContext) { BindModelOnSuccessOrFail(bindingContext, () => ModelBinderUtils.CreateSimpleArgumentMap(actionContext.Request.RequestUri.Query) ?? ModelBinderUtils.CreateArgumentMap(DeserializeQueryString(actionContext)), ModelBinderUtils.CreateArgumentMapForMalformedArgs); return(true); }
private static Task BindFromQuery(ModelBindingContext bindingContext) => ModelBinderUtils.BindModelOnSuccessOrFail(bindingContext, async() => ModelBinderUtils.CreateSingleValueArgument(await ModelBinderUtils.DeserializeQueryString(bindingContext), false), ModelBinderUtils.CreateMalformedArguments <SingleValueArgument>);
public Task BindModelAsync(ModelBindingContext bindingContext) => ModelBinderUtils.BindModelOnSuccessOrFail(bindingContext, async() => ModelBinderUtils.CreatePromptArgMap(await ModelBinderUtils.DeserializeJsonContent(bindingContext), true), ModelBinderUtils.CreateMalformedArguments <PromptArgumentMap>);
private static Task BindFromQuery(ModelBindingContext bindingContext) => ModelBinderUtils.BindModelOnSuccessOrFail(bindingContext, async() => ModelBinderUtils.CreateSimpleArgumentMap(bindingContext.HttpContext.Request.QueryString.ToString()) ?? ModelBinderUtils.CreateArgumentMap(await ModelBinderUtils.DeserializeQueryString(bindingContext), true), ModelBinderUtils.CreateMalformedArguments <ArgumentMap>);
private static Task BindFromBody(ModelBindingContext bindingContext) => ModelBinderUtils.BindModelOnSuccessOrFail(bindingContext, async() => ModelBinderUtils.CreateArgumentMap(await ModelBinderUtils.DeserializeJsonContent(bindingContext), true), ModelBinderUtils.CreateMalformedArguments <ArgumentMap>);
protected static JObject DeserializeQueryString(HttpActionContext actionContext) { using (Stream stream = ModelBinderUtils.QueryStringToStream(actionContext.Request.RequestUri.Query)) { return(ModelBinderUtils.DeserializeJsonStream(stream)); } }
protected static JObject DeserializeJsonContent(HttpActionContext actionContext) { Stream stream = actionContext.Request.Content.ReadAsStreamAsync().Result; return(ModelBinderUtils.DeserializeJsonStream(stream)); }