feat: Added Base for UserManagement

This commit is contained in:
2025-12-14 22:48:18 +01:00
parent 7aa7a25333
commit 31dce0e0de
14 changed files with 98 additions and 15 deletions

View File

@@ -16,6 +16,7 @@
<PageTitle>GlobalList</PageTitle>
<div class="container-fluid mt-4">
<!-- #region CreateEntity -->
<div class="d-flex justify-content-between align-items-center mb-4">
<h2>Global List</h2>
<button class="btn btn-info" type="button" @onclick="ToogleCollapseNewGlobalEntity">@(isCollapseNewGlobalEntityOpen ? "X" : "Add Entity")</button>
@@ -59,13 +60,17 @@
</EditForm>
</div>
</div>
<!-- #endregion -->
<!-- #region Show Entitys -->
<div class="row">
@foreach (var Entity in GlobalEntities)
{
<div name="Enity-Container" class="col-12 col-md-6 col-lg-3 mb-4 Entity-Container">
<div name="Entity-Container-Card" class="Entity-Container-Card">
<div class="Entity-Container-Menu-Button">
<button type="button" class="Entity-Container-Menu-Button" data-bs-toogle="modal" data-bs-target="@Entity.Id">&#8942;</button>
<div class="Entity-Container-Menu-Button dropdown ms-1">
<button type="button" class="Entity-Container-Menu-Button btn menu-btn" data-bs-toggle="modal" data-bs-target="#modal-@Entity.Id">&#8942;</button>
</div>
<div class="modal fade" id="@Entity.Id" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
@@ -103,8 +108,26 @@
</div>
</div>
</div>
<div class="modal fade" id="modal-@Entity.Id" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Optionen</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<button class="btn btn-danger" type="button" @onclick="() => DeleteEntity(Entity)">Delete Entity</button>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
}
</div>
<!-- #endregion -->
</div>
@code
@@ -268,4 +291,24 @@
GenreIds.Add(GenreId);
}
}
private async Task DeleteEntity(GlobalEntity entity)
{
if(entity.PicturePath != null)
{
try
{
File.Delete(Path.Combine("wwwroot", entity.PicturePath));
}
catch(Exception)
{
}
}
CouchLogDB.GlobalEntities.Remove(entity);
await CouchLogDB.SaveChangesAsync();
NavigationManager.NavigateTo(NavigationManager.Uri, true);
}
}