In Umbraco, we have 2 ways to submit form data, we can use either RenderMvcController or SurfaceController, ideally, you would use the Surface Controller to post a contact form or user login details and RenderMvcController for a search form.
This blog will show how you can use both ways to submit a form and also includes Html.BeginUmbracoForm which you will find only allows both post and get methods.
To run this example, I have created a helper class library, a model class library and a core class library.
The core class library is where the controllers are, I prefer this way of coding as I believe that the UI should not contain any controllers.
The helper class has the test data and the model class contains the model.
Below is how the site structure is laid out.
The test data just has hardcoded data about pets and I add the data to a list.
The helper class get the URL of the search results page, I'm using a content picker in the CMS for this, the reason for this is what would happen if you had a doctype that had multiple pages, it would be very difficult to know which doctype is the page we require. Also what would happen if the client changed the name of doctype or deleted it and created a new one, using the content picker, the client just needs to update the picker with the new doctype and we are ready to go. More than likely the search page would be a dedicated doctype so the need to use a content picker would not be required, but I'm just showing how it can be used.
The view model is used to display the data, one uses RenderModel as I use RnnderMvcController and the other is a plain SurfaceController.
The controller filters the search results and has both get and post ActionResults.
If you notice the action for the form gets its value from the search helper which simply returns the URL, the last 2 forms uses Html.BeginUmbracoForm, with the last form having a get method and you will notice the URL also contains the hidden field 'ufprt'