Hi, i hope someone can help me with this. Ive created a form in umbraco and its used for emailing reservations. This is working fine. But now i want to save each reservation into the database. I can't figure out how im supposed to do that.
Thank you very much Brendan:)
i've managed to create a table in the database. But how do i insert a record, or get data into a view using a select statement?
Saving Form Content to Database
Hi, i hope someone can help me with this. Ive created a form in umbraco and its used for emailing reservations. This is working fine. But now i want to save each reservation into the database. I can't figure out how im supposed to do that.
Greets, Jaco
Here's the official docs jaco:
https://our.umbraco.com/documentation/getting-started/Code/Creating-Forms/
You'd do the DB work in the controller.
Here's one way to create the custom table:
https://our.umbraco.com/documentation/Extending/Database/
Umbraco uses NPoco (ORM) and a lot of developers like using it for CRUD (Create, Retrieve, Udate and Delete) code:
https://github.com/schotime/NPoco
It should be available within Umbraco.
Thank you very much Brendan:) i've managed to create a table in the database. But how do i insert a record, or get data into a view using a select statement?
Look at the links I shared above.
The steps should be:
On save data
On retrieve data
In the controller (look at the docs for surface controllers) you'll have an action method to retrieve the data from the DB and populate a model
Model gets returned to the view
Profit
If you are new to Umbraco Paul Seal has a brilliant YouTube channel that will help you get up to speed:
https://codeshare.co.uk/videos/
is working on a reply...