I have the following scenario:
- My .NET Core API has two Endpoints
CreateProduct
andUpdateProduct
. - The only difference between the two will be that
UpdateProduct
will need to know the ID of the Product to update
Is it bad style to create a common CreateOrUpdateModel
with a nullable property for the ID that will be set only in case of an Update?
Since the models need to be validated, I'd like to avoid to create two almost identical validators where the only difference is that one additionally validates the ID while the other doesn't. This could be easily solved with a condition in the validator.