static void DeleteCustomer(CloudTable table, CustomerUS customer)
        {
            TableOperation delete = TableOperation.Delete(customer);

            table.Execute(delete);
            Console.WriteLine("Customer deleted successfully");
        }
Beispiel #2
0
        static void ExecuteBatchOperations(CloudTable table)
        {
            TableBatchOperation batch = new TableBatchOperation();

            var customer1 = new CustomerUS("Manuel", "*****@*****.**");
            var customer2 = new CustomerUS("Raul", "*****@*****.**");
            var customer3 = new CustomerUS("Samantha", "*****@*****.**");

            batch.Insert(customer1);
            batch.Insert(customer2);
            batch.Insert(customer3);

            var customer = GetCustomer(table, "US", "*****@*****.**");

            DeleteCustomer(table, customer);

            table.ExecuteBatch(batch);
        }
        static void Main(string[] args)
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
                CloudConfigurationManager.GetSetting("StorageConnection"));

            CloudTableClient tableClient = storageAccount.CreateCloudTableClient();

            CloudTable table = tableClient.GetTableReference("customers");

            table.CreateIfNotExists();

            //CreateCustomer(table, new CustomerUS("Mike", "*****@*****.**"));
            //GetCustomer(table, "US", "*****@*****.**");
            //GetAllCustomers(table);

            //var updateMike = GetCustomer(table, "US", "*****@*****.**");
            //updateMike.Name = "Michael";
            //UpdateCustomer(table, updateMike);
            //DeleteCustomer(table, updateMike);

            //GetAllCustomers(table);

            TableBatchOperation batch = new TableBatchOperation();

            var customer1 = new CustomerUS("Frank", "*****@*****.**");
            var customer2 = new CustomerUS("Steve", "*****@*****.**");
            var customer3 = new CustomerUS("Joe", "*****@*****.**");

            batch.Insert(customer1);
            batch.Insert(customer2);
            batch.Insert(customer3);

            table.ExecuteBatch(batch);

            GetAllCustomers(table);

            Console.ReadKey();
        }
        static void CreateCustomer(CloudTable table, CustomerUS customer)
        {
            TableOperation insert = TableOperation.Insert(customer);

            table.Execute(insert);
        }
Beispiel #5
0
        static void DeleteCustomer(CloudTable cloudTable, CustomerUS customerUS)
        {
            TableOperation deleteOperation = TableOperation.Delete(customerUS);

            cloudTable.Execute(deleteOperation);
        }
Beispiel #6
0
        static void UpdateCustomer(CloudTable cloudTable, CustomerUS customerUS)
        {
            TableOperation updateOperation = TableOperation.Replace(customerUS);

            cloudTable.Execute(updateOperation);
        }
Beispiel #7
0
        static void CreateCustomer(CloudTable cloudTable, CustomerUS customerUS)
        {
            TableOperation insertOperation = TableOperation.Insert(customerUS);

            cloudTable.Execute(insertOperation);
        }
Beispiel #8
0
        static void DeleteCustomer(CloudTable table, CustomerUS customer)
        {
            TableOperation delete = TableOperation.Delete(customer);

            table.Execute(delete);
        }
Beispiel #9
0
        static void UpdateCustomer(CloudTable table, CustomerUS customer)
        {
            TableOperation update = TableOperation.Replace(customer);

            table.Execute(update);
        }