Startpunkten
This commit is contained in:
77
Views/Person/Index.cshtml
Normal file
77
Views/Person/Index.cshtml
Normal file
@@ -0,0 +1,77 @@
|
||||
@model List<Person>
|
||||
@{
|
||||
ViewData["Title"] = "Mina medlemmar";
|
||||
}
|
||||
@if (TempData.ContainsKey("MeddelandeSuccess")) {
|
||||
<div class="alert alert-success alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>Allt klart!</strong> @TempData["MeddelandeSuccess"]
|
||||
</div>
|
||||
}
|
||||
else if (TempData.ContainsKey("MeddelandeFail")) {
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>Något gick fel.</strong> @TempData["MeddelandeFail"]
|
||||
</div>
|
||||
}
|
||||
|
||||
<h2 class="text-center mt-3 mb-4">@ViewData["Title"]</h2>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<a href="/Person/Create" class="btn btn-success mb-5">Skapa ny medlem</a>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Search" method="post">
|
||||
<div class="form-group">
|
||||
<label class="control-label">
|
||||
<input name="search" id="search" class="form-control" tabindex="1" placeholder="Namn eller E-post" />
|
||||
</label>
|
||||
<input type="submit" value="Sök" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container mb-5">
|
||||
@if (Model.Count() >= 0) {
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>@Html.ActionLink("Id", "Index", null, new { sortOrder = "PersonId" })</th>
|
||||
<th>@Html.ActionLink("Namn", "Index", null, new { sortOrder = "PersonNamn" })</th>
|
||||
<th>@Html.ActionLink("E-post", "Index", null, new { sortOrder = "Epost" })</th>
|
||||
<th>@Html.ActionLink("Ålder", "Index", null, new { sortOrder = "Alder" })</th>
|
||||
<th>@Html.ActionLink("Registrerad", "Index", null, new { sortOrder = "StartDatum" })</th>
|
||||
<th>Visningsbild</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var person in Model) {
|
||||
<tr>
|
||||
<td>@person.PersonId</td>
|
||||
<td>@person.PersonNamn</td>
|
||||
<td>@person.Epost</td>
|
||||
<td>@person.Alder</td>
|
||||
<td>@person.StartDatum</td>
|
||||
<td><img src="~/images/userphoto/@person.Visningsbild" alt="@person.PersonNamn" class="visningsbild" /></td>
|
||||
<td>
|
||||
<a asp-action="Delete" asp-controller="Person" asp-route-Id="@person.PersonId">Ta bort</a> |
|
||||
<a asp-action="Edit" asp-controller="Person" asp-route-Id="@person.PersonId">Editera</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user