Skip to content

Instantly share code, notes, and snippets.

@tugberkugurlu
Created July 22, 2012 13: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 tugberkugurlu/3159768 to your computer and use it in GitHub Desktop.
Save tugberkugurlu/3159768 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Xml.Serialization;
namespace MvcApplication56.Controllers {
public class Person {
public string Name { get; set; }
public virtual ICollection<Order> Orders { get; set; }
}
public class Order {
public string Name { get; set; }
}
public class PeopleController : ApiController {
public IEnumerable<Person> Get() {
return new List<Person> {
new Person {
Name = "Foo",
Orders = new List<Order> {
new Order { Name = "Bar" }
}
},
new Person {
Name = "Foo",
Orders = new List<Order> {
new Order { Name = "Bar" }
}
}
};
}
public Person Get(int id) {
return new Person {
Name = "Foo",
Orders = new List<Order> {
new Order { Name = "Bar" }
}
};
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment