Beispiel #1
0
        private async Task DeleteTestData()
        {
            var products = await _client.FindEntriesAsync("Products");

            foreach (var product in products)
            {
                var productName = product["ProductName"] as string;
                if (string.IsNullOrEmpty(productName) || productName.StartsWith("Test"))
                {
                    await _client.DeleteEntryAsync("Products", product);
                }
            }
            var categories = await _client.FindEntriesAsync("Categories");

            foreach (var category in categories)
            {
                var categoryName = category["CategoryName"] as string;
                if (string.IsNullOrEmpty(categoryName) || categoryName.StartsWith("Test"))
                {
                    await _client.DeleteEntryAsync("Categories", category);
                }
            }
            var transports = await _client.FindEntriesAsync("Transport");

            foreach (var transport in transports)
            {
                if (int.Parse(transport["TransportID"].ToString()) > 2)
                {
                    await _client.DeleteEntryAsync("Transport", transport);
                }
            }
            var employees = await _client.FindEntriesAsync("Employees");

            foreach (var employee in employees)
            {
                var employeeName = employee["LastName"] as string;
                if (string.IsNullOrEmpty(employeeName) || employeeName.StartsWith("Test"))
                {
                    await _client.DeleteEntryAsync("Employees", employee);
                }
            }
        }
Beispiel #2
0
        private async Task DeleteTestData()
        {
            var products = await _client.FindEntriesAsync("Products");

            foreach (var product in products)
            {
                if (product["Name"].ToString().StartsWith("Test"))
                {
                    await _client.DeleteEntryAsync("Products", product);
                }
            }

            var workTaskModels = await _client.FindEntriesAsync("WorkTaskModels");

            foreach (var workTaskModel in workTaskModels)
            {
                if (workTaskModel["Code"].ToString().StartsWith("Test"))
                {
                    await _client.DeleteEntryAsync("workTaskModels", workTaskModel);
                }
            }
        }