Introduced the RecordState property to manage the state of prospects, enabling soft deletion and restoration. Updated related database migrations, UI interactions, and filtering logic to accommodate this addition. Also included automatic database migration at runtime to ensure schema compatibility.
63 lines
2.1 KiB
C#
63 lines
2.1 KiB
C#
using Blazorise;
|
|
using FoodsharingSiegen.Server.BaseClasses;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace FoodsharingSiegen.Server.Dialogs
|
|
{
|
|
public partial class ConfirmDialog : FsBase
|
|
{
|
|
#region Parameters
|
|
|
|
[Parameter]
|
|
public Func<Task>? OnConfirm { get; set; }
|
|
|
|
[Parameter]
|
|
public string? Message { get; set; }
|
|
|
|
#endregion
|
|
|
|
#region Public Method ShowAsync
|
|
|
|
/// <summary>
|
|
/// Displays the confirm dialog with the specified title, message, and confirmation action.
|
|
/// </summary>
|
|
/// <param name="modalService">The modal service used to display the dialog.</param>
|
|
/// <param name="title">The title of the confirmation dialog. Defaults to "Bestätigen" if null.</param>
|
|
/// <param name="message">The message displayed in the confirmation dialog.</param>
|
|
/// <param name="onConfirm">The action to invoke when the user confirms.</param>
|
|
/// <returns>A task that represents the asynchronous operation of displaying the dialog.</returns>
|
|
public static async Task ShowAsync(IModalService modalService, string? title, string? message, Func<Task> onConfirm)
|
|
{
|
|
title ??= "Bestätigen";
|
|
|
|
var x = new Action<ModalProviderParameterBuilder<ConfirmDialog>>(b =>
|
|
{
|
|
b.Add(nameof(OnConfirm), onConfirm);
|
|
b.Add(nameof(Message), message);
|
|
});
|
|
|
|
var options = new ModalInstanceOptions
|
|
{
|
|
// Size = ModalSize.Small
|
|
};
|
|
|
|
await modalService.Show(title, x, options);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Private Method ConfirmClickAsync
|
|
|
|
/// <summary>
|
|
/// Invokes the confirmation action if it is set.
|
|
/// </summary>
|
|
/// <returns>A task that represents the asynchronous operation.</returns>
|
|
private async Task ConfirmClickAsync()
|
|
{
|
|
if (OnConfirm != null) await OnConfirm.Invoke();
|
|
await ModalService.Hide();
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |