Skip to content

Instantly share code, notes, and snippets.

@csharpfritz
Created March 24, 2015 20:50
Show Gist options
  • 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 = "[email protected]", Name = "Barney Poland"},
new Contact { Id = 2, EmailAddress = "[email protected]", Name = "Lacy Barrera"},
new Contact { Id = 3, EmailAddress = "[email protected]", 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