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(); }
public void CreateCustomer(CloudTable cloudTable, CustomerUK customer) { TableOperation insert = TableOperation.Insert(customer); cloudTable.Execute(insert); }
private void UpdateCustomer(CloudTable cloudTable, CustomerUK customerToUpdate) { TableOperation update = TableOperation.Replace(customerToUpdate); cloudTable.Execute(update); }