// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Microsoft.AspNetCore.Mvc
{
///
/// An that when executed will produce a Unprocessable Entity (422) response.
///
public class UnprocessableEntityObjectResult : ObjectResult
{
///
/// Creates a new instance.
///
/// containing the validation errors.
public UnprocessableEntityObjectResult(ModelStateDictionary modelState)
: this(new SerializableError(modelState))
{
}
///
/// Creates a new instance.
///
/// Contains errors to be returned to the client.
public UnprocessableEntityObjectResult(object error)
: base(error)
{
StatusCode = StatusCodes.Status422UnprocessableEntity;
}
}
}