MVC Basic Form Save Data
From Logic Wiki
View
@model LogicBO.Models.AppContact .... .... @using (Html.BeginForm()) { @Html.TextBoxFor(model => model.Email, new { htmlAttributes = new { @class = "pm-form-textfield", id = "pm_s_full_name", name = "pm_s_full_name", placeholder = "Name *" } })
@Html.TextBoxFor(model => model.Email, new { htmlAttributes = new { @class = "pm-form-textfield", id = "pm_s_full_name", name = "pm_s_full_name", placeholder = "Name *" } })
@Html.LabelFor(model => model.Email, htmlAttributes: new { @class = "control-label col-md-2" })
@Html.EditorFor(model => model.Email, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model => model.Email, "", new { @class = "text-danger" })
<input type="submit" value="Create" class="btn btn-default" /> }
Controller
public class ContactController : Controller { private BoContext db = new BoContext();