59 lines
2.1 KiB
Plaintext
59 lines
2.1 KiB
Plaintext
@model List<Sport>
|
|
@{
|
|
ViewData["Title"] = "Detta finns på SportPalatset";
|
|
}
|
|
<h2 class="text-center mt-3 mb-4">@ViewData["Title"]</h2>
|
|
|
|
<a href="/Sport/Create" class="btn btn-success mb-5">Skapa ny Sport</a>
|
|
|
|
@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>
|
|
}
|
|
|
|
<div class="container">
|
|
@if (Model.Count() >= 1) {
|
|
<table class="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Id</th>
|
|
<th>SportNamn</th>
|
|
<th>Traningstider</th>
|
|
<th>Bild</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var sport in Model) {
|
|
<tr>
|
|
<td>@sport.SportId</td>
|
|
<td>@sport.SportNamn</td>
|
|
<td>@sport.Traningstider</td>
|
|
<td><img src="~/images/sport/@sport.Bakgrundsbild" alt="@sport.SportNamn" class="visningsbild" /></td>
|
|
<td>
|
|
<a asp-action="Delete" asp-controller="Sport" asp-route-Id="@sport.SportId">Ta bort</a> |
|
|
<a asp-action="Edit" asp-controller="Sport" asp-route-Id="@sport.SportId">Editera</a> |
|
|
<a asp-action="Details" asp-controller="Sport" asp-route-Id="@sport.SportId">Detaljer</a>
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
|
|
</table>
|
|
}
|
|
|
|
</div>
|
|
|
|
|
|
@section Scripts {
|
|
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
|
}
|