Timestamp button to database

I have created a form that is to be filled out by the user, and in the form i have the user insert the date and time that this form is submitted, but i would like to make it where the user hits the submit button this will timestamp the form in the database. I am using C# as the backend and razor pages for HTML. How could i code something like this, and would this be coded in the controller for the button and then referenced as a asp-action, or asp-controller?