I have a question. I have a dot net core 3.1 app. I have a appointment controller which calls a appointment service. The appointment calls a validation service to validate some values in de database. I want to stop the execution if the value doesn't exists in the database. I want to return a list of response to the client from the validation service.
How can i a return a response from the validation service?
code example:
public async Task<bool> Validate() {
bool ValidateOK = await
_validateService.ValidateObjects(ObjectsToValidate);
if (ValidateOK == false) //Throw list of Errors en messages return true;
}
Responses wil be like this
{
Errorcode: 201
ErrorMessage: Value1 doesn't exists in the database
}
{
Errorcode: 201
ErrorMessage: Value2 doesn't exists in the database
}