Merge branch 'blazor' of https://codefirst.iut.uca.fr/git/antoine.jourdain/SAE_2A_Anglais into blazor
commit
c992a59d98
@ -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