public ITestActionResult GetPersonInfos([FromODataUri] int key) { ComplextTypeCollectionTests_Person person = Persons.FirstOrDefault(p => p.Id == key); if (person == null) { return(NotFound()); } return(Ok(person.PersonInfos.AsQueryable())); }
static ComplextTypeCollectionTests_PersonsController() { Persons = new List <ComplextTypeCollectionTests_Person>(); var address1 = new ComplextTypeCollectionTests_Address(); address1.City = "Bellevue"; address1.State = "WA"; address1.CountryOrRegion = "USA"; address1.Zipcode = 98007; var address2 = new ComplextTypeCollectionTests_Address(); address2.City = "Redmond"; address2.State = "WA"; address2.CountryOrRegion = "USA"; address2.Zipcode = 98052; var address3 = new ComplextTypeCollectionTests_Address(); address3.City = "Issaquah"; address3.State = "WA"; address3.CountryOrRegion = "USA"; address3.Zipcode = 98029; ComplextTypeCollectionTests_Person person = new ComplextTypeCollectionTests_Person(); person.Id = 1; person.Name = "James King"; person.Addresses.Add(address1); person.Addresses.Add(address2); person.Addresses.Add(address3); person.PersonInfos = Enumerable.Range(1, 5).Select(e => new ComplexTypeCollectionTests_PersonInfo { CompanyName = "Company " + e, Years = 10 + e }); Persons.Add(person); }