Today i have written a custom ValidateFilterAttribute that will eliminate some unnessary code in API Controller and save our developing time too. We will simply try to handle all validation from one common piece of code rather then writting every single validation in a controller.
I have used
OnActionExecuting(HttpActionContext actionExecutingContext)
as this allows me to remove the boilerplate if (!ModelState.IsValid) return
from the methods.
No comments:
Post a Comment