[HttpPost]
Public ActionResult Contact(EmailMessage message)
{
}
and your Model object looked like this:
public class EmailMessage
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
....
}
you can automatically bind it to your action method if your form elements match the EmailMessage model
<% using (Html.BeginForm()) { %>
First Name: <input type="text" id="FirstName" />
Last Name: <input type="text" id="LastName" />
Email <input type="text" id="Email" />
....
<% } %>
, [DisplayName] MVC.
public class EmailMessage
{
[DisplayName("First Name")]
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
....
}
<% using (Html.BeginForm()) { %>
<%: LabelFor(m => m.FirstName) %><%: EditorFor(m => m.FirstName) %>
<%: LabelFor(m => m.LastName) %><%: EditorFor(m => m.LastName) %>
<%: LabelFor(m => m.Email) %><%: EditorFor(m => m.Email) %>
<% } %>