Skip to content

Instantly share code, notes, and snippets.

@dfbaskin
Last active December 16, 2015 08:58
Show Gist options
  • Save dfbaskin/5409429 to your computer and use it in GitHub Desktop.
Save dfbaskin/5409429 to your computer and use it in GitHub Desktop.
public class PeopleController : ApiController
{
public IEnumerable<Person> Get()
{
var repository = new ExampleDataRepository();
return repository.GetSomePeople();
}
public Person Get(int id)
{
var repository = new ExampleDataRepository();
var person = repository.GetPerson(id);
if (person == null)
{
throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));
}
return person;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment