Confirm Dialog

This commit is contained in:
Andre Beging
2022-04-04 16:00:17 +02:00
parent 1513ed9169
commit b8dfeee518
4 changed files with 33 additions and 15 deletions

View File

@@ -1,4 +1,5 @@
using FoodsharingSiegen.Contracts.Entity;
using Blazorise;
using FoodsharingSiegen.Contracts.Entity;
using FoodsharingSiegen.Server.Data.Service;
using FoodsharingSiegen.Server.Dialogs;
using Microsoft.AspNetCore.Components;
@@ -7,6 +8,7 @@ namespace FoodsharingSiegen.Server.Pages
{
public partial class Prospects
{
[Inject] IMessageService MessageService { get; set; }
[Inject] public ProspectService ProspectService { get; set; } = null!;
[Inject] public UserService UserService { get; set; } = null!;
@@ -57,8 +59,18 @@ namespace FoodsharingSiegen.Server.Pages
private async Task RemoveInteraction(Guid arg)
{
await ProspectService.RemoveInteraction(arg);
await LoadProspects();
var confirm = await MessageService.Confirm("Interaktion wirklich löschen?", "Bestätigen", o => {
o.ConfirmButtonText = "Ja, wirklich!";
o.CancelButtonText = "Abbrechen";
o.ShowMessageIcon = false;
});
if (confirm)
{
await ProspectService.RemoveInteraction(arg);
await LoadProspects();
}
}
}
}