private static void removeData(newsItems items, string tableName) { //return if no headlines to process if (items.NewsItems.Count == 0) { return; } CloudTable table = getTableStorage(tableName); // Create the table if it doesn't exist. table.CreateIfNotExists(); // Create the TableOperation object that deletes the customer entity. foreach (newsItem item in items.NewsItems) { // Create a retrieve operation that expects a customer entity. TableOperation retrieveOperation = TableOperation.Retrieve <newsItem>(item.PartitionKey, item.RowKey); // Execute the operation. TableResult retrievedResult = table.Execute(retrieveOperation); // Assign the result to a CustomerEntity. newsItem deleteEntity = (newsItem)retrievedResult.Result; // Create the Delete TableOperation. if (deleteEntity != null) { TableOperation deleteOperation = TableOperation.Delete(deleteEntity); // Execute the operation. table.Execute(deleteOperation); } } }
public void Add(newsItem thisNewsItem) { this._newsItems.Add(thisNewsItem); }