This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ValidateModelStateAttribute : ActionFilterAttribute | |
{ | |
public override void OnActionExecuting(ActionExecutingContext actionContext) | |
{ | |
var modelState = actionContext.ModelState; | |
if (!actionContext.ModelState.IsValid) | |
{ | |
actionContext.Result = new BadRequestObjectResult(actionContext.ModelState.Values.SelectMany(v => v.Errors)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>apiactionasync</Title> | |
<Shortcut>apiactionasync</Shortcut> | |
<Description>Code snippet for an api async action.</Description> | |
<Author>Ahmed Xubair</Author> | |
</Header> | |
<Snippet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>apiaction</Title> | |
<Shortcut>apiaction</Shortcut> | |
<Description>Code snippet for an api action.</Description> | |
<Author>Ahmed Xubair</Author> | |
</Header> | |
<Snippet> |