Files
hermes/WebApp/Views/Home/Index.cshtml

52 lines
1.5 KiB
Plaintext

@model List<WebApp.Entities.Event>
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://learn.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
<a href="/Events/Create" class="btn btn-success">Create New Event</a>
</div>
<hr />
<h2 class="mt-4">Lista wydarzeń</h2>
@if (Model.Any())
{
<table class="table table-bordered table-striped mt-3">
<thead>
<tr>
<th>Nazwa</th>
<th>Miejsce</th>
<th>Data</th>
<th>Organizacja</th>
<th>Akcje</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>@item.Title</td>
<td>@item.Location</td>
<td>@item.EventDate.ToString("yyyy-MM-dd HH:mm")</td>
<td>@item.OrganisationId</td>
<td>
<form asp-action="Delete" asp-controller="Events" method="post" style="display:inline;">
<input type="hidden" name="id" value="@item.EventId" />
<button type="submit" class="btn btn-danger" onclick="return confirm('Na pewno chcesz usunąć to wydarzenie?')">Usuń</button>
</form>
</td>
</tr>
}
</tbody>
</table>
}
else
{
<p class="mt-3">Brak wydarzeń do wyświetlenia.</p>
}