You have one of two choices one just using ServiceStack and other is Jiwa Specific
ServiceStackSet up a request filter and modify things there, but you would need to deserialize the Json change it and then serialize it again
JiwaIn Jiwa on most objects that run through the api there are events on the serialization and deserialization, the one most appropriate for what you are wanting to do is is DTODeserialiseStart which has the signature shown below, where the sender is obviously the sales order object and the DTO is the incoming Json deserialized onto the DTO object from the Service Model namespace ready to be transposed onto the sales order business object. You would be changing the DTO's values so they thne got transposed to the sales order
- Code: Select all
DTODeserialiseStart(sender As Object, e As System.EventArgs, ByRef DTO As JiwaServiceModel.SalesOrders.SalesOrder)
I would use the Jiwa specific version for anything that requires looking up values etc as you have access to a manager on the sales order object.
A further thought on this is if this a business rule in general or you don't care if the values are set on other orders you could put the code in the save start event of the order.