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?
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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?