DEV Community

[Comment from a deleted post]
Collapse
 
krishnamhn009 profile image
LazyDeveloper

Great article ...I have a requirement to implement model validation in .net core API where endpoints are symmetric. Say for endpoints Model A is used as input parameter.Model A contains below properties

class A {
string name,
string email,
string Id,
string age
}

for Post endpoint,email,name,age and Id are required fields but for PUT endpoint only email is required. How I can use DataAnnotation & model state where required fields vary?