Submitting a form to a service and handling server-side validation on an HTML client
In this recipe, we will look at an example of submitting an HTML form to an existing ServiceStack service. We will utilize some JavaScript that the ServiceStack server hosts, which helps us bind data from a form.
Getting ready
If you are starting with a new project, please go to the section Creating a ServiceStack solution with Visual Studio and NuGet in Appendix A, Getting Started, to help you get set up.
We will be using some existing services from the PlacesToVisit
examples with some modification to show the use of validation.
How to do it…
Within the
Configure
method of your application host, register dependencies for the use of Sqlite and the repository interface from thePlacesToVisit
domain, as follows:container.RegisterAutoWired<PlacesToVisitAppSettings>(); var appSettings = container.Resolve<PlacesToVisitAppSettings>(); var dbFactory = new OrmLiteConnectionFactory(appSettings.Get("sqlLiteConnectionString...