Created
July 8, 2012 17:18
-
-
Save ntotten/3071859 to your computer and use it in GitHub Desktop.
ASP.NET Web API Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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