Skip to content

Instantly share code, notes, and snippets.

@seangwright
Created April 25, 2016 18:51
Show Gist options
  • Save seangwright/78abf83f17b3ee6883d3e08e100aef65 to your computer and use it in GitHub Desktop.
Save seangwright/78abf83f17b3ee6883d3e08e100aef65 to your computer and use it in GitHub Desktop.
ValueController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Description;
namespace WiredViews.WIR03.Web.Api.Controllers
{
/// <summary>
/// Value controller
/// </summary>
[RoutePrefix("values")]
public class ValueController : ApiController
{
/// <summary>
/// Returns values
/// </summary>
/// <returns></returns>
[Route("")]
[ResponseType(typeof(IEnumerable<string>))]
public IHttpActionResult Get()
{
return Ok(new string[] { "value1", "value2" });
}
// GET: api/Value/5
public string Get(int id)
{
return "value";
}
// POST: api/Value
public void Post([FromBody]string value)
{
}
// PUT: api/Value/5
public void Put(int id, [FromBody]string value)
{
}
// DELETE: api/Value/5
public void Delete(int id)
{
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment