Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brockallen/48bce00681a87ba3325d74f09f72874a to your computer and use it in GitHub Desktop.
Save brockallen/48bce00681a87ba3325d74f09f72874a to your computer and use it in GitHub Desktop.
ASP.NET Core MVC action method snippets
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>mvcaction</Title>
<Shortcut>mvcaction</Shortcut>
<Description>Code snippet for an action.</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
</Header>
<Snippet>
<Imports>
<Import>
<Namespace>Microsoft.AspNetCore.Mvc</Namespace>
</Import>
</Imports>
<Declarations>
<Literal>
<ID>name</ID>
<ToolTip>Replace with the name of the action</ToolTip>
<Default>Action</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[public IActionResult $name$()
{
return View();$end$
}]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>mvcactionasync</Title>
<Shortcut>mvcasync</Shortcut>
<Description>Code snippet for an async action.</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
<ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
</Header>
<Snippet>
<Imports>
<Import>
<Namespace>Microsoft.AspNetCore.Mvc</Namespace>
</Import>
<Import>
<Namespace>System.Threading.Tasks</Namespace>
</Import>
</Imports>
<Declarations>
<Literal>
<ID>name</ID>
<ToolTip>Replace with the name of the action</ToolTip>
<Default>Action</Default>
</Literal>
</Declarations>
<Code Language="csharp"><![CDATA[public async Task<IActionResult> $name$()
{
return View();$end$
}]]></Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment