PUT Method Example

The following method updates an existing customer in response to a PUT request.

One or more parameters are used to identify the Customer object to be updated. The remaining parameters are used to update the object.

putCustomer(pId: Integer; pName: String; pAddress: String);
vars
    customer: Customer;
begin
    // Identify customer to be updated using pId
    customer := app.myRoot.allCustomers.getAtKey(pId);
    if not customer = null then
        // Update customer using pName and pAddress
        beginTransaction;
        customer.name := pName;
        customer.address := pAddress;
        commitTransaction;
    endif;
end;