Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Created September 27, 2016 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcomartin/fc23c7cb3d3fde081eebe77587f86303 to your computer and use it in GitHub Desktop.
Save dcomartin/fc23c7cb3d3fde081eebe77587f86303 to your computer and use it in GitHub Desktop.
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
namespace AspNetCore.Mvc.AttributeRouting.Demo.Controllers
{
[Route("api/[controller]")]
public class ValuesController : Controller
{
[HttpGet, Route("api/values/getmore")]
public IEnumerable<string> GetMoreStuff()
{
return new string[] { "value3", "value4" };
}
// GET api/values
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment