static ComplextTypeCollectionTests_PersonsController()
        {
            Persons = new List<ComplextTypeCollectionTests_Person>();

            var address1 = new ComplextTypeCollectionTests_Address();
            address1.City = "Bellevue";
            address1.State = "WA";
            address1.Country = "USA";
            address1.Zipcode = 98007;

            var address2 = new ComplextTypeCollectionTests_Address();
            address2.City = "Redmond";
            address2.State = "WA";
            address2.Country = "USA";
            address2.Zipcode = 98052;

            var address3 = new ComplextTypeCollectionTests_Address();
            address3.City = "Issaquah";
            address3.State = "WA";
            address3.Country = "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);

            Persons.Add(person);
        }
Esempio n. 2
0
        static ComplextTypeCollectionTests_PersonsController()
        {
            Persons = new List <ComplextTypeCollectionTests_Person>();

            var address1 = new ComplextTypeCollectionTests_Address();

            address1.City    = "Bellevue";
            address1.State   = "WA";
            address1.Country = "USA";
            address1.Zipcode = 98007;

            var address2 = new ComplextTypeCollectionTests_Address();

            address2.City    = "Redmond";
            address2.State   = "WA";
            address2.Country = "USA";
            address2.Zipcode = 98052;

            var address3 = new ComplextTypeCollectionTests_Address();

            address3.City    = "Issaquah";
            address3.State   = "WA";
            address3.Country = "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);

            Persons.Add(person);
        }
        public IQueryable <ComplexTypeCollectionTests_PersonInfo> GetPersonInfos([FromODataUri] int key)
        {
            ComplextTypeCollectionTests_Person person = Persons.FirstOrDefault(p => p.Id == key);

            if (person == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            return(person.PersonInfos.AsQueryable());
        }
        static ComplextTypeCollectionTests_PersonsController()
        {
            Persons = new List <ComplextTypeCollectionTests_Person>();

            var address1 = new ComplextTypeCollectionTests_Address();

            address1.City    = "Bellevue";
            address1.State   = "WA";
            address1.Country = "USA";
            address1.Zipcode = 98007;

            var address2 = new ComplextTypeCollectionTests_Address();

            address2.City    = "Redmond";
            address2.State   = "WA";
            address2.Country = "USA";
            address2.Zipcode = 98052;

            var address3 = new ComplextTypeCollectionTests_Address();

            address3.City    = "Issaquah";
            address3.State   = "WA";
            address3.Country = "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);
        }
        static ComplextTypeCollectionTests_PersonsController()
        {
            Persons = new List<ComplextTypeCollectionTests_Person>();

            var address1 = new ComplextTypeCollectionTests_Address();
            address1.City = "Bellevue";
            address1.State = "WA";
            address1.Country = "USA";
            address1.Zipcode = 98007;

            var address2 = new ComplextTypeCollectionTests_Address();
            address2.City = "Redmond";
            address2.State = "WA";
            address2.Country = "USA";
            address2.Zipcode = 98052;

            var address3 = new ComplextTypeCollectionTests_Address();
            address3.City = "Issaquah";
            address3.State = "WA";
            address3.Country = "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);
        }