|
|
@ -10,6 +10,9 @@ using Microsoft.Extensions.Localization;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Blazor.Pages
|
|
|
|
namespace Blazor.Pages
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Partial class for the List page.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
public partial class List
|
|
|
|
public partial class List
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private List<Item> items;
|
|
|
|
private List<Item> items;
|
|
|
@ -22,15 +25,29 @@ namespace Blazor.Pages
|
|
|
|
[Inject]
|
|
|
|
[Inject]
|
|
|
|
public IWebHostEnvironment WebHostEnvironment { get; set; }
|
|
|
|
public IWebHostEnvironment WebHostEnvironment { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// The navigation manager for navigating between pages.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
[Inject]
|
|
|
|
[Inject]
|
|
|
|
public NavigationManager NavigationManager { get; set; }
|
|
|
|
public NavigationManager NavigationManager { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// The modal service for displaying modal dialogs
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
[CascadingParameter]
|
|
|
|
[CascadingParameter]
|
|
|
|
public IModalService Modal { get; set; }
|
|
|
|
public IModalService Modal { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// The localizer for the List page.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
[Inject]
|
|
|
|
[Inject]
|
|
|
|
public IStringLocalizer<List> Localizer { get; set; }
|
|
|
|
public IStringLocalizer<List> Localizer { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Event handler for reading data in the data grid.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="e">The event arguments.</param>
|
|
|
|
|
|
|
|
/// <returns>A task representing the asynchronous operation.</returns>
|
|
|
|
private async Task OnReadData(DataGridReadDataEventArgs<Item> e)
|
|
|
|
private async Task OnReadData(DataGridReadDataEventArgs<Item> e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (e.CancellationToken.IsCancellationRequested)
|
|
|
|
if (e.CancellationToken.IsCancellationRequested)
|
|
|
@ -45,6 +62,10 @@ namespace Blazor.Pages
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Event handler for deleting an item.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="id">The id of the item to delete.</param>
|
|
|
|
private async void OnDelete(int id)
|
|
|
|
private async void OnDelete(int id)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var parameters = new ModalParameters();
|
|
|
|
var parameters = new ModalParameters();
|
|
|
|