Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
En réalité c'est la suppression d'un utilisateur avec popupblazor
parent
6954e4a4c1
commit
8824d51e9c
@ -1,13 +1,14 @@
|
||||
<Router AppAssembly="@typeof(App).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<PageTitle>Not found</PageTitle>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p role="alert">Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
|
||||
<CascadingBlazoredModal>
|
||||
<Router AppAssembly="@typeof(App).Assembly">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<PageTitle>Not found</PageTitle>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p role="alert">Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
</CascadingBlazoredModal>
|
@ -0,0 +1,10 @@
|
||||
<div class="simple-form">
|
||||
|
||||
<p>
|
||||
Are you sure you want to delete @item.Name ?
|
||||
</p>
|
||||
|
||||
<button @onclick="ConfirmDelete" class="btn btn-primary">Delete</button>
|
||||
|
||||
<button @onclick="Cancel" class="btn btn-secondary">Cancel</button>
|
||||
</div>
|
@ -0,0 +1,38 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Blazored.Modal;
|
||||
using Blazored.Modal.Services;
|
||||
using adminBlazor.Services;
|
||||
using adminBlazor.Models;
|
||||
|
||||
namespace adminBlazor.Modals
|
||||
{
|
||||
public partial class DeleteConfirmation
|
||||
{
|
||||
[CascadingParameter]
|
||||
public BlazoredModalInstance ModalInstance { get; set; }
|
||||
|
||||
[Inject]
|
||||
public IDataService DataService { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public int Id { get; set; }
|
||||
|
||||
private User item = new User();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// Get the item
|
||||
item = await DataService.GetById(Id);
|
||||
}
|
||||
|
||||
void ConfirmDelete()
|
||||
{
|
||||
ModalInstance.CloseAsync(ModalResult.Ok(true));
|
||||
}
|
||||
|
||||
void Cancel()
|
||||
{
|
||||
ModalInstance.CancelAsync();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue