HangrySoT/Hangry

Use model binding on the initial form

Opened this issue · 0 comments

when using MVC and Razor, the input element are usually create with Html.HiddenFor(m=> m.Lat) some can't be bound, like the unusual file input that is used, but the name element can still be set using @Html.NameFor(m=> m.image)

this doesn't add much in the way of functionality, but on a bigger app this helps with client side input field validation of required fields etc. This will need to @model namespace.to.model declaration at the top of index.cshtml

this makes it safer when refactoring code, as if the fields are ever renamed in the *.cs code you will get an error in the *.cshtml

Check out Pushpays VP Engineering talking about Connascence