Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add message to context.result

I'm creating a DataAnnotation that if not successful will return a BadRequest.

context.Result = new BadRequestResult();

That works fine.

I want to include a message along with this, but BadRequestResult doesn't appear to take any message params?

Is there a way to do this...include a message to say e.g. "reference number not supplied"

Thanks

like image 356
thegunner Avatar asked Jan 03 '23 19:01

thegunner


1 Answers

This appears to work:

context.Result = new BadRequestObjectResult("Reference number not supplied.");
like image 152
thegunner Avatar answered Jan 15 '23 18:01

thegunner