Events-MVC (example with htmx)

This commit is contained in:
Boris Milašinović
2026-04-25 22:21:35 +02:00
parent eb04483417
commit 0ee1b22f61
114 changed files with 7966 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
@model Events.MVC.Models.Events.EventViewModel
<tr id="event-@Model.Id">
<td>@Model.Id</td>
<td>@Model.Name</td>
<td>@Model.EventDate.ToString("dd.MM.yyyy.")</td>
<td>@Model.ParticipantsCount</td>
<td class="text-end">
<div class="d-inline-flex gap-2">
<a
asp-controller="Registrations"
asp-action="Index"
asp-route-eventId="@Model.Id"
class="btn btn-sm btn-outline-secondary">
Registrations
</a>
<button
type="button"
class="btn btn-sm btn-outline-primary"
hx-get="@Url.Action("EditRow", "Events", new { id = Model.Id })"
hx-target="#event-@Model.Id"
hx-swap="outerHTML">
Edit
</button>
<form
asp-action="Delete"
asp-route-id="@Model.Id"
method="post"
class="d-inline"
hx-post="@Url.Action("Delete", "Events", new { id = Model.Id })"
hx-include="#events-state"
hx-target="#events-list"
hx-swap="outerHTML"
hx-confirm="Delete event '@Model.Name'?">
@Html.AntiForgeryToken()
<button type="submit" class="btn btn-sm btn-outline-danger">Delete</button>
</form>
</div>
</td>
</tr>