MVC Forms
MVC Forms: GET and POST Actions, Model Binding a Form.
Updated
- GET and POST Actions (Journeyman): A search form sends a GET request with a query string; a form that saves data sends a POST. Pair a GET action that shows the form with a POST action that saves it, redirect afterward, and protect it with an anti-forgery token.
- Model Binding a Form (Journeyman): ASP.NET Core fills an action's parameters, even a whole Product, from the request by matching names. asp-for writes inputs whose names match the model, and ModelState says when a value didn't fit.