Skip to main content

Deleting Records

Use DeleteAsync to remove an entity by its ID.

Delete a record

var endpoint = new CoworkerEndpoint(client);
await endpoint.DeleteAsync(id);
Console.WriteLine("Coworker deleted.");

Error handling

DeleteAsync throws InvalidOperationException if the deletion fails — for example, when the entity has dependent records:
try
{
    await endpoint.DeleteAsync(id);
    Console.WriteLine("Deleted successfully.");
}
catch (InvalidOperationException ex)
{
    Console.WriteLine($"Deletion failed: {ex.Message}");
}
Deletions are permanent. There is no undo. Make sure you are deleting the correct entity.