InvalidModelStateResult Class

Summary

An action result that returns a @!:StatusCodes.Status400BadRequest- response and performs content negotiation on an [System.Web.Http.HttpError](System.Web.Http.HttpError.yml) based on a [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]().

Syntax

public class InvalidModelStateResult : ObjectResult, IActionResult

GitHub

View on GitHub

class System.Web.Http.InvalidModelStateResult

Constructors

InvalidModelStateResult(Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary, System.Boolean)

Initializes a new instance of the [System.Web.Http.InvalidModelStateResult](System.Web.Http.InvalidModelStateResult.yml) class.

Arguments:
  • modelState (Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary) – The model state to include in the error.
  • includeErrorDetail (System.Boolean) – <see langword=”true” /> if the error should include exception messages; otherwise, <see langword=”false” />.
public InvalidModelStateResult(ModelStateDictionary modelState, bool includeErrorDetail)

Properties

IncludeErrorDetail()

Gets a value indicating whether the error should include exception messages.

Return type:System.Boolean
public bool IncludeErrorDetail { get; }
ModelState()

Gets the model state to include in the error.

Return type:Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary
public ModelStateDictionary ModelState { get; }

Methods

ExecuteResultAsync(Microsoft.AspNet.Mvc.ActionContext)
Arguments:
Return type:

System.Threading.Tasks.Task

public override Task ExecuteResultAsync(ActionContext context)