Example #1
0
        public StorageAccountTable()
        {
            // Sample run
            CreateAccount();
            CloudTable table = GetTable($"customers{DateTime.Now.ToLongTimeString().Replace(":", string.Empty)}");

            CreateCustomer(table, new CustomerUK("David", "*****@*****.**"));
            CreateCustomer(table, new CustomerUK("Davidco", "*****@*****.**"));

            PrintAllCustomers(table);

            CustomerUK customerToUpdate = GetCustomer(table, "UK", "*****@*****.**");

            customerToUpdate.Name = "Dave";
            UpdateCustomer(table, customerToUpdate);

            PrintAllCustomers(table);

            DeleteCustomer(table, customerToUpdate);

            PrintAllCustomers(table);

            BatchInsert(table);

            PrintAllCustomers(table);

            table.Delete();
        }
Example #2
0
        public void CreateCustomer(CloudTable cloudTable, CustomerUK customer)
        {
            TableOperation insert = TableOperation.Insert(customer);

            cloudTable.Execute(insert);
        }
Example #3
0
        private void UpdateCustomer(CloudTable cloudTable, CustomerUK customerToUpdate)
        {
            TableOperation update = TableOperation.Replace(customerToUpdate);

            cloudTable.Execute(update);
        }