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