日期:2014-05-17 浏览次数:20498 次
<div class="row"> @Html.LabelFor(model => model.Department) @Html.EditorFor(model => model.Department) @Html.ValidationMessageFor(model => model.Department) </div> <div class="row"> @Html.LabelFor(model => model.Telephone) @Html.EditorFor(model => model.Telephone) @Html.ValidationMessageFor(model => model.Telephone) </div> <div class="row"> @Html.LabelFor(model => model.Mobile) @Html.EditorFor(model => model.Mobile) @Html.ValidationMessageFor(model => model.Mobile) </div> <div class="row"> @Html.LabelFor(model => model.Address) @Html.EditorFor(model => model.Address) @Html.ValidationMessageFor(model => model.Address) </div> <div class="row"> @Html.LabelFor(model => model.Desc) @Html.TextAreaFor(model => model.Desc) @Html.ValidationMessageFor(model => model.Desc) @Html.Hidden("Status",true) </div> <div class="row"> <input type="submit" value="注册" /> <a href="javascript:history.go(-1)">返回</a> @*@Html.ActionLink("返回", "Index")*@ </div>
#region 注册用户 public ActionResult Register() { return View(); } [HttpPost] public ActionResult Register(FormCollection collection) { var user = new NalUser(); TryUpdateModel(user, collection); if (ModelState.IsValid) { acc.AddUser(user); acc.SaveChanges(); } return RedirectToAction("Index"); } #endregion