@model Gaming.Models.GameUser @{ ViewBag.Title = "Create New User"; } <h2>Create</h2> <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script> @using (Html.BeginForm()) { @Html.ValidationSummary(true) <fieldset> <legend>GameUser</legend> <div class="editor-label"> @Html.LabelFor(model => model.Name) </div> <div class="editor-field"> @Html.EditorFor(model => model.Name) @Html.ValidationMessageFor(model => model.Name) </div> <div class="editor-label"> @Html.LabelFor(model => model.Info) </div> <div class="editor-label"> @Html.TextAreaFor(model => model.Info, new { cols = 90, @rows = 20 }) @Html.ValidationMessageFor(model => model.Info) </div> <div class="editor-label"> @Html.LabelFor(model => model.Category_ID, "Category") </div> <div class="editor-field"> @Html.DropDownList("Category_ID") @Html.ValidationMessageFor(model => model.Category_ID) </div> <div class="editor-field"> @Html.Hidden("LastActiveDate") </div> <p> <input type="submit" value="Submit" /> </p> </fieldset> }
[HttpPost] public ActionResult Create(GameUser gameuser) { if (ModelState.IsValid) { db.GameUsers.AddObject(gameuser); db.SaveChanges(); return RedirectToAction("Index"); } return View(gameuser); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)