Viewing and creating new people implemented
This commit is contained in:
64
MVCUI/Views/People/Create.cshtml
Normal file
64
MVCUI/Views/People/Create.cshtml
Normal file
@ -0,0 +1,64 @@
|
||||
@model TrackerLibrary.Models.PersonModel
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Create";
|
||||
}
|
||||
|
||||
<h2>Create New Person</h2>
|
||||
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>PersonModel</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.EmailAddress, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.EmailAddress, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.EmailAddress, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.CellPhoneNumber, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.CellPhoneNumber, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.CellPhoneNumber, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
||||
45
MVCUI/Views/People/Index.cshtml
Normal file
45
MVCUI/Views/People/Index.cshtml
Normal file
@ -0,0 +1,45 @@
|
||||
@model IEnumerable<TrackerLibrary.Models.PersonModel>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Index";
|
||||
}
|
||||
|
||||
<h2>View All People</h2>
|
||||
|
||||
<p>
|
||||
@Html.ActionLink("Create New", "Create")
|
||||
</p>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.FirstName)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.LastName)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.EmailAddress)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.CellPhoneNumber)
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.FirstName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LastName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.EmailAddress)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CellPhoneNumber)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</table>
|
||||
@ -24,12 +24,15 @@
|
||||
<li class="nav-item">
|
||||
@Html.ActionLink("Home", "Index", "Home", new { area = "" }, new { @class = "nav-link text-light" })
|
||||
</li>
|
||||
@*<li class="nav-item">
|
||||
@Html.ActionLink("About", "About", "Home", new { area = "" }, new { @class = "nav-link text-light" })
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
@Html.ActionLink("Contact", "Contact", "Home", new { area = "" }, new { @class = "nav-link text-light" })
|
||||
</li>*@
|
||||
@Html.ActionLink("People", "Index", "People", new { area = "" }, new { @class = "nav-link text-light" })
|
||||
</li>
|
||||
@*<li class="nav-item">
|
||||
@Html.ActionLink("About", "About", "Home", new { area = "" }, new { @class = "nav-link text-light" })
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
@Html.ActionLink("Contact", "Contact", "Home", new { area = "" }, new { @class = "nav-link text-light" })
|
||||
</li>*@
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
Reference in New Issue
Block a user