WEB API --->
public async Task<IHttpActionResult> CreatePost(ChildClient c)
{
if(!ModelState.IsValid) {
throw ...
}
..
}
public class Client
{
[Required]
public bool HasBaseValue { get; set; } = true;
[Required]
public string Name { get; set; } = "stringvalue";
}
public class ChildClient : Client
{
[Required]
public bool HasFieldValue { get; set; } = true;
[Required]
public string Name1 { get; set; } = "stringvalue";
}
ModelState.Keys gives following errors: HasBaseValue,HasFieldValue if both fields are not supplied. why it still shows in error field even though default value is set. NOTE: default values are already populated in 'c object' when I debug and check by breakpoint.