Template
mirror of
https://github.com/egmont11/ASP.Net-Core-MVC-Template.git
synced 2026-07-24 07:09:56 +02:00
Fixed up the database connection, added admin account and admin area
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
@model UserModel
|
||||
@{
|
||||
ViewData["Title"] = "User Details";
|
||||
}
|
||||
|
||||
<div class="mb-4">
|
||||
<a asp-action="Index" class="btn btn-secondary">← Back to List</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h3 class="card-title mb-0">User Information: @Model.UserName</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<dl class="row">
|
||||
<dt class="col-sm-3">ID</dt>
|
||||
<dd class="col-sm-9">@Model.Id</dd>
|
||||
|
||||
<dt class="col-sm-3">Username</dt>
|
||||
<dd class="col-sm-9">@Model.UserName</dd>
|
||||
|
||||
<dt class="col-sm-3">Email</dt>
|
||||
<dd class="col-sm-9">@Model.Email</dd>
|
||||
|
||||
<dt class="col-sm-3">Role</dt>
|
||||
<dd class="col-sm-9">
|
||||
<span class="badge @(Model.Role == UserRole.Admin ? "bg-danger" : "bg-info")">@Model.Role</span>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,34 @@
|
||||
@model IEnumerable<UserModel>
|
||||
@{
|
||||
ViewData["Title"] = "User Management";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<h1>Users</h1>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped table-hover">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Username</th>
|
||||
<th>Email</th>
|
||||
<th>Role</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var user in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>@user.Id</td>
|
||||
<td>@user.UserName</td>
|
||||
<td>@user.Email</td>
|
||||
<td><span class="badge @(user.Role == UserRole.Admin ? "bg-danger" : "bg-info")">@user.Role</span></td>
|
||||
<td>
|
||||
<a asp-action="Details" asp-route-id="@user.Id" class="btn btn-sm btn-outline-primary">Details</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
Reference in New Issue
Block a user