Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@csharpfritz
Created March 24, 2015 20:50
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 csharpfritz/f6008fff20509f744a58 to your computer and use it in GitHub Desktop.
Save csharpfritz/f6008fff20509f744a58 to your computer and use it in GitHub Desktop.
public class ContactsController : ApiController
{
[HttpGet]
public IEnumerable<Contact> GetAll()
{
return new Contact[] {
new Contact { Id = 1, EmailAddress = "barney@contoso.com", Name = "Barney Poland"},
new Contact { Id = 2, EmailAddress = "lacy@contoso.com", Name = "Lacy Barrera"},
new Contact { Id = 3, EmailAddress = "lora@microsoft.com", Name = "Lora Riggs"}
};
}
}
public class ValuesController : ApiController
{
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
public string GetById(int id)
{
return "value";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment