Is there a way that message (Yes/No) is presented inside scout server?
Reason for this is save with warnings.
For example you have some logic for save some entity and some validity on this entity in backend. In some cases, user need to be inform that saving this record might lead to some trouble, so he need to confirm save.
Right now I have implementation like this :
Scout Client -> Scout Server -> Backend -> Scout Server -> Scout Client -> Scout Server -> Scout Backend
save called pass parameter to backend try to save; return excaption return exception to client present popUp sent parameter force force save
but I don't like that inside client you need to handle this. It would be nicer if client would call only save and all will be handled in scout server and backend.
Is there a better way for this?
Marko
I am not sure how you want to handle this server side only.
If you need to have some user interaction with a confirmation looking like this: “Existing data will be overwritten” (or whatever your business logic is in the backend) and “Are you sure you want to save?”, you need to do it in the client part of your application. Otherwise you cannot interrupt the existing process, inform your user and let the form open.
If you do not need any user interaction, a solution "server+backend only" is possible.
Here is a sketch of how the store method (client side) could look like:
With SaveResult being something like that:
(If this makes sense, you could add the explanation coming from the backend and the FormData could be a generic parameter).
If you have this pattern a lot of times, it is easy to make it generic enough for all your forms (with interfaces and abstract classes). This way you write this handling only once (with a part in the server and a part in the client).