38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
// 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 System.Collections.Generic;
|
|
using Microsoft.AspNet.Mvc;
|
|
using Microsoft.AspNet.Mvc.ModelBinding;
|
|
using ModelBindingWebSite.Models;
|
|
|
|
namespace ModelBindingWebSite.Controllers
|
|
{
|
|
[Route("Validation/[Action]")]
|
|
public class ValidationController : Controller
|
|
{
|
|
[FromServices]
|
|
public ITestService ControllerService { get; set; }
|
|
|
|
public bool SkipValidation(Resident resident)
|
|
{
|
|
return ModelState.IsValid;
|
|
}
|
|
|
|
public bool AvoidRecursive(SelfishPerson selfishPerson)
|
|
{
|
|
return ModelState.IsValid;
|
|
}
|
|
|
|
public bool DoNotValidateParameter([FromServices] ITestService service)
|
|
{
|
|
return ModelState.IsValid;
|
|
}
|
|
}
|
|
|
|
public class SelfishPerson
|
|
{
|
|
public string Name { get; set; }
|
|
public SelfishPerson MySelf { get { return this; } }
|
|
}
|
|
} |