xdataWebDataSet change Child Object for a Parent

I'm looking for a way with web core app and xData to change an existing relation from Parent to a different child object
Ex :
Parent = invoice object from "invoices" table
Child = status object with code, name, description... from "status" table
I would like to change relation of parent to a different child (status created with id =1 > status saved with id = 2)
Is there a way to use xdataWebDataSet in a way similar to :

XWDS_Request.FieldByName('id_status').....= identification of different child objet

of course if I put ID of status as integer, the put method fires a 500 error, quite logic for xData.
Binding a status object as reference to parent is quite easy with VCL xDataClient, but with web core app, I 'm looking for a way...



How would you do that with TXDataClient, exactly?

I select the Invoice Child object
Current_Invoice := TXDataOperationContext.Current.GetManager.Find<TInvoice>.Where(TLinq.Eq('Invoice_id', InvoiceID)).UniqueResult;

Then I search the new status as Parent I want to use
New_Status := TXDataOperationContext.Current.GetManager.Find<TStatus>.Where(TLinq.Eq('Status_code', 'Saved')).UniqueResult;

Define the relation in my invoice (status is the relation Parent (status) > Child (Invoice))
Current_Invoice.status := New_Status;
And update

That code doesn't use a TXDataClient, but Aurelius. It's very different, that code deals with local database, while XData is remote communication via JSON.

If you have a complex operation, the always recommended way is that you create a service operation in XData that handles the complex code, and create simple parameters that you receive and return. Then just invoke such method from the web (or any other) application passing the parameters so XData does the complex operation for you.

My bad you are right, xDataClient isn't implied here.
Your answer was the option I want to avoid as it generates several DB requests

  1. update for xdataDataSet to populate object
  2. call to implemented method to manage status switch
    Here, such scenario isn't too impacting IO DB as the application is B2B and quite low usage. But I was thinking to look for more efficient approach.

Thanks Wagner

On the contrary, if you concentrate your business logic in the XData service operation, it will be a very simple and unique request from the web application, thus it reduces the HTTP requests.