Documentation Index
Fetch the complete documentation index at: https://learn.nexudus.com/llms.txt
Use this file to discover all available pages before exploring further.
Full CRUD Lifecycle
This example demonstrates the complete lifecycle of an entity — creating, reading, updating, verifying the update, and finally deleting it.
Complete example
var endpoint = new CoworkerEndpoint(client);
// 1. Create
var coworker = new Coworker
{
FullName = "Lifecycle Test",
Email = "lifecycle@example.com",
CoworkerType = eCoworkerRecordType.Individual,
Businesses = new List<long> { businessId }
};
long id = await endpoint.CreateAsync(coworker);
Console.WriteLine($"Created: {id}");
// 2. Read
var fetched = await endpoint.GetAsync(id);
Console.WriteLine($"Fetched: {fetched!.FullName}");
// 3. Update
fetched.CompanyName = "New Company";
await endpoint.UpdateAsync(fetched);
Console.WriteLine("Updated.");
// 4. Verify
var updated = await endpoint.GetAsync(id);
Console.WriteLine($"Company: {updated!.CompanyName}");
// 5. Delete
await endpoint.DeleteAsync(id);
Console.WriteLine("Deleted.");
Error handling
Wrap each operation in a try/catch block if you need granular error recovery:
try
{
long id = await endpoint.CreateAsync(entity);
var fetched = await endpoint.GetAsync(id);
fetched!.CompanyName = "Updated";
await endpoint.UpdateAsync(fetched);
await endpoint.DeleteAsync(id);
}
catch (InvalidOperationException ex)
{
Console.WriteLine($"Operation failed: {ex.Message}");
}