> ## 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.

# Updating Records

> How to update existing entities in Nexudus using the SDK.

# Updating Records

Fetch the entity, modify its properties, then call `UpdateAsync`. The full entity is sent to the API.

## Update a coworker

```csharp theme={null}
var endpoint = new CoworkerEndpoint(client);

var coworker = await endpoint.GetAsync(id);
coworker!.CompanyName = "Updated Corp";
coworker.Position = "Senior Engineer";

await endpoint.UpdateAsync(coworker);
Console.WriteLine("Coworker updated.");
```

## Update a product

```csharp theme={null}
var endpoint = new ProductEndpoint(client);

var product = await endpoint.GetAsync(productId);
product!.Name = "Premium Day Pass";
product.Price = 35.00m;

await endpoint.UpdateAsync(product);
```

## Error handling

`UpdateAsync` throws `InvalidOperationException` on failure:

```csharp theme={null}
try
{
    await endpoint.UpdateAsync(entity);
}
catch (InvalidOperationException ex)
{
    Console.WriteLine($"Update failed: {ex.Message}");
}
```

<Tip>
  Always fetch the latest version of the entity before updating to avoid overwriting changes made by other users or processes.
</Tip>
