Skip to content

Instantly share code, notes, and snippets.

@ntotten
Created July 8, 2012 17:18
Show Gist options
  • Select an option

  • Save ntotten/3071859 to your computer and use it in GitHub Desktop.

Select an option

Save ntotten/3071859 to your computer and use it in GitHub Desktop.
ASP.NET Web API Example
public class Person {
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public virtual ICollection<Message> Messages { get; set; }
}
public class PersonController : ApiController
{
// GET api/person
[Queryable]
public IQueryable<Person> Get()
{
var context = new MyAppContext();
var people = from p in context.People
select p;
return people;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment