Skip to content

Instantly share code, notes, and snippets.

@marco-mendes
Created May 28, 2017 19:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marco-mendes/c01f214945403aaf1d5db3013a3acc50 to your computer and use it in GitHub Desktop.
Save marco-mendes/c01f214945403aaf1d5db3013a3acc50 to your computer and use it in GitHub Desktop.
[Route("api/[controller]")]
public class ValuesController : Controller
{
// 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";
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment