Consolidated repeated methods for interaction/user deletion into reusable components to improve maintainability. Introduced a `ConfirmDialog` for consistent confirmation UI and streamlined associated logic across pages. Removed redundant methods and enhanced admin-specific page security checks.
72 lines
2.0 KiB
C#
72 lines
2.0 KiB
C#
using FoodsharingSiegen.Contracts.Entity;
|
|
using FoodsharingSiegen.Contracts.Model;
|
|
using FoodsharingSiegen.Server.Data.Service;
|
|
using FoodsharingSiegen.Server.Dialogs;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace FoodsharingSiegen.Server.Pages
|
|
{
|
|
/// <summary>
|
|
/// The prospects done class (a. beging, 07.02.2023)
|
|
/// </summary>
|
|
public partial class ProspectsVerify
|
|
{
|
|
#region Dependencies
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value of the prospect service (ab)
|
|
/// </summary>
|
|
[Inject]
|
|
public ProspectService ProspectService { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value of the user service (ab)
|
|
/// </summary>
|
|
[Inject]
|
|
public UserService UserService { get; set; } = null!;
|
|
|
|
#endregion
|
|
|
|
#region Private Properties
|
|
|
|
private ProspectFilter Filter { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value of the prospect list (ab)
|
|
/// </summary>
|
|
private List<Prospect>? ProspectList { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region Override InitializeDataAsync
|
|
|
|
/// <inheritdoc />
|
|
protected override async Task InitializeDataAsync()
|
|
{
|
|
// Load prospects
|
|
await LoadProspects();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Private Method LoadProspects
|
|
|
|
/// <summary>
|
|
/// Loads the prospects (a. beging, 11.04.2022)
|
|
/// </summary>
|
|
private async Task LoadProspects()
|
|
{
|
|
var parameter = new GetProspectsParameter
|
|
{
|
|
CannotHaveInteractions = [InteractionType.Complete],
|
|
MustHaveInteractions = [InteractionType.ReleasedForVerification]
|
|
};
|
|
var prospectsR = await ProspectService.GetProspectsAsync(parameter);
|
|
if (prospectsR.Success) ProspectList = prospectsR.Data;
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |