Create Audits on Actions
This commit is contained in:
25
FoodsharingSiegen.Server/Pages/AuditView.razor
Normal file
25
FoodsharingSiegen.Server/Pages/AuditView.razor
Normal file
@@ -0,0 +1,25 @@
|
||||
@page "/audit"
|
||||
|
||||
@using FoodsharingSiegen.Server.BaseClasses
|
||||
@using FoodsharingSiegen.Contracts.Entity
|
||||
@using FoodsharingSiegen.Server.Data
|
||||
@using FoodsharingSiegen.Server.Data.Service
|
||||
|
||||
@inherits FsBase
|
||||
|
||||
<PageTitle>Aktivitäten</PageTitle>
|
||||
|
||||
<h4>Aktivitäten</h4>
|
||||
|
||||
<DataGrid TItem="Audit"
|
||||
Data="@Audits"
|
||||
Responsive>
|
||||
<DataGridColumn Field="@nameof(Audit.Created)" Caption="Datum" Width="180px" />
|
||||
<DataGridColumn Caption="Aktion">
|
||||
<DisplayTemplate>
|
||||
<span>
|
||||
@((context as Audit).User?.Name) @(AuditHelper.CreateText(context))
|
||||
</span>
|
||||
</DisplayTemplate>
|
||||
</DataGridColumn>
|
||||
</DataGrid>
|
||||
46
FoodsharingSiegen.Server/Pages/AuditView.razor.cs
Normal file
46
FoodsharingSiegen.Server/Pages/AuditView.razor.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using FoodsharingSiegen.Contracts.Entity;
|
||||
using FoodsharingSiegen.Server.Data.Service;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
namespace FoodsharingSiegen.Server.Pages
|
||||
{
|
||||
/// <summary>
|
||||
/// The audit view class (a. beging, 23.05.2022)
|
||||
/// </summary>
|
||||
public partial class AuditView
|
||||
{
|
||||
#region Dependencies (Injected)
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the audit service (ab)
|
||||
/// </summary>
|
||||
[Inject] public AuditService? AuditService { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the audits (ab)
|
||||
/// </summary>
|
||||
private List<Audit>? Audits { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Override OnInitializedAsync
|
||||
|
||||
/// <summary>
|
||||
/// Ons the initialized (a. beging, 23.05.2022)
|
||||
/// </summary>
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var loadR = await AuditService?.Load(100)!;
|
||||
if (loadR.Success)
|
||||
Audits = loadR.Data;
|
||||
|
||||
await base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
<div style="width: 100%; max-width: 500px;">
|
||||
<h4>Mein Profil</h4>
|
||||
<Button Color="Color.Primary" Clicked="SaveProfile">Speichern</Button>
|
||||
<Fields Class="mt-1">
|
||||
<Fields Class="my-3">
|
||||
<Validations @ref="ValidationsRef">
|
||||
<Validation Validator="ValidationRule.IsNotEmpty">
|
||||
<Field ColumnSize="ColumnSize.Is12">
|
||||
|
||||
Reference in New Issue
Block a user