public IHttpActionResult UpdateAddress(ODataUntypedActionParameters parameters)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var    id                = (int)parameters["ID"];
            var    address           = parameters["Address"] as EdmComplexObject;
            var    conventionAddress = new ConventionAddress();
            object temp              = null;

            if (address.TryGetPropertyValue("Street", out temp))
            {
                conventionAddress.Street = temp.ToString();
            }
            if (address.TryGetPropertyValue("City", out temp))
            {
                conventionAddress.City = temp.ToString();
            }
            if (address.TryGetPropertyValue("ZipCode", out temp))
            {
                conventionAddress.ZipCode = temp.ToString();
            }
            ConventionCustomer customer = _customers.Where(c => c.ID == id).FirstOrDefault();

            customer.Address = conventionAddress;
            return(Ok(_customers));
        }
        public bool AdvancedFunction([FromODataUri] IEnumerable <int> numbers,
                                     [FromODataUri] IEnumerable <ConventionGender> genders,
                                     [FromODataUri] ConventionAddress address, [FromODataUri] IEnumerable <ConventionAddress> addresses,
                                     [FromODataUri] ConventionCustomer customer, [FromODataUri] IEnumerable <ConventionCustomer> customers)
        {
            Assert.Equal(new[] { 1, 2, 3 }, numbers);
            Assert.Equal(new[] { ConventionGender.Male, ConventionGender.Female }, genders);

            IEnumerable <ConventionAddress> newAddress = addresses.Concat(new[] { address });

            Assert.Equal(2, newAddress.Count());
            foreach (ConventionAddress addr in newAddress)
            {
                Assert.Equal("Zi Xin Rd.", addr.Street);
                Assert.Equal("Shanghai", addr.City);
                Assert.Equal("2001100", addr.ZipCode);
            }

            IEnumerable <ConventionCustomer> newCustomers = customers.Concat(new[] { customer });

            Assert.Equal(2, newCustomers.Count());
            foreach (ConventionCustomer cust in newCustomers)
            {
                Assert.Equal(7, cust.ID);
                Assert.Equal("Tony", cust.Name);
                Assert.Null(cust.Address);
            }

            return(true);
        }