Startpunkten

This commit is contained in:
2026-03-05 15:43:26 +01:00
commit dd99fb7b01
95 changed files with 3262 additions and 0 deletions

58
Views/Sport/Index.cshtml Normal file
View File

@@ -0,0 +1,58 @@
@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">&times;</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">&times;</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");}
}