Method BadRequest
| Improve this Doc View SourceBadRequest(ModelStateDictionary)
Represents a validation error that prevents the controller action from completing.
Declaration
public static BadRequestObjectResult BadRequest(this ModelStateDictionary modelState)
Parameters
Type | Name | Description |
---|---|---|
ModelStateDictionary | modelState | The ModelStateDictionary containing errors to be returned to the client. |
Returns
Type | Description |
---|---|
BadRequestObjectResult | An instance of type BadRequestObjectResult that contains an instance of type Result. |
Remarks
Used in situations where the consumer provides invalid data.
BadRequest(ModelStateDictionary, String)
Represents a validation error that prevents the controller action from completing.
Declaration
public static BadRequestObjectResult BadRequest(this ModelStateDictionary modelState, string message)
Parameters
Type | Name | Description |
---|---|---|
ModelStateDictionary | modelState | The ModelStateDictionary containing errors to be returned to the client. |
String | message | An error message. |
Returns
Type | Description |
---|---|
BadRequestObjectResult | An instance of type BadRequestObjectResult that contains an instance of type Result. |
Remarks
Used in situations where the consumer provides invalid data.