Jul 1, 2013 at 4:59 PM
Edited Jul 1, 2013 at 5:42 PM
If you can elaborate on what you need to do (close connections, indicate if this only needs to be run in certain conditions, etc.) we may be able to give you a more appropriate answer.
There are 2 ways that I know of.
1) Using ViewResultEventSinks from Control.cs. Markus can probably explain this much better than I.
2) Create code to respond to an action.
The CloseCurrentViewAction is great if you want to close a non-editable view since there is usually no clean up required.
Here is an example of a save method that checks for changes and then closes the view. It might get you started because you can just change this to handle your specific situation:
You will note that it saves the data, etc. and then, if the response from the save is successful, it closes the view:
public void Save()
var response = new SaveCustomerResponse();
var request = new SaveCustomerRequest();
response = service.SaveCustomer(request);
This could be created by the constructor via the following code:
execute: (a, o) => Save(),
Note: this code is essentially from their online class - so if you have taken one of those, you probably have this code already.