public void Update(string customerId, Customer customer)
        {
            var current = _client.CreateDocumentQuery(_collectionLink)
                .Where(x => x.Id == customerId)
                .AsEnumerable()
                .FirstOrDefault();

            _client.ReplaceDocumentAsync(current.SelfLink, customer).Wait();
        }
        static void Main(string[] args)
        {
            _client = new DocumentClient(new Uri(EndpointUrl), AuthorizationKey);

            var database = FindDatabase(_client, "erp");
            var collection = FindDocumentCollection(_client, database, "Customers");

            var repository = new CustomerRepository(_client, collection.SelfLink);

            var customer = new Customer()
            {
                Id = "BA761989-DA77-494D-B354-2CDB2DB420E2",
                FirstName = "John",
                LastName = "Smith",
                Email = "*****@*****.**",
                Orders = new List<Order>
                {
                    new Order
                    {
                        Number = "123-45",
                        Date = new DateTime(2015, 1, 1),
                        Amount = 245.78m
                    },

                    new Order
                    {
                        Number = "123-46",
                        Date = new DateTime(2015, 1, 23),
                        Amount = 70.21m
                    },
                }
            };

            //Create Customer
            repository.Create(customer);

            //Find Customer
            //var found = repository.Read(customer.Id);

            //Update Customer
            //found.LastName = "Test";
            //repository.Update(customer.Id, found);

            //Delete Customer
            repository.Delete(customer.Id);
        }
 public void Create(Customer customer)
 {
     _client.CreateDocumentAsync(_collectionLink, customer).Wait();
 }