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

@@ -0,0 +1,7 @@
@page "/AdminSettings"
<h3>Index</h3>
@code {
}

View File

@@ -0,0 +1,7 @@
@page "/AdminSettings/UserManagement"
<h3>UserManagement</h3>
@code {
}

View File

@@ -0,0 +1,2 @@
@using CouchLog.Components.AdminSettings.Shared
@layout AdminSettingsLayout

View File

@@ -0,0 +1,17 @@
@inherits LayoutComponentBase
@layout CouchLog.Components.Layout.MainLayout
<h1>Manage your account</h1>
<div>
<h2>Change your account settings</h2>
<hr />
<div class="row">
<div class="col-lg-3">
<AdminSettingsNavMenu />
</div>
<div class="col-lg-9">
@Body
</div>
</div>
</div>

View File

@@ -0,0 +1,18 @@
@using Microsoft.AspNetCore.Identity
@using CouchLog.Data
@inject SignInManager<ApplicationUser> SignInManager
<ul class="nav nav-pills flex-column">
<li class="nav-item">
<NavLink class="nav-link" href="/AdminSettings/UserManagement" Match="NavLinkMatch.All">User Management</NavLink>
</li>
<!--
<li class="nav-item">
<NavLink class="nav-link" href=""></NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link" href=""></NavLink>
</li>
-->
</ul>

View File

@@ -6,10 +6,6 @@
</div>
<main>
<div class="top-row px-4">
<a href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a>
</div>
<article class="content px-4">
@Body
</article>

View File

@@ -1,7 +0,0 @@
@page "/AdminSettings"
@using Microsoft.AspNetCore.Authorization
@attribute [Authorize]
<PageTitle>Admin Settings</PageTitle>

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);
}
}

View File

@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36511.14
# Visual Studio Version 18
VisualStudioVersion = 18.1.11304.174 d18.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CouchLog", "CouchLog.csproj", "{4FBF15C3-5FC5-4605-9EBC-3F7DA1ADC47A}"
EndProject

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 113 KiB