@page "/media/libraries/local/{Id:int}"
@using ErsatzTV.Application.Libraries
@using ErsatzTV.Application.Libraries.Commands
@using ErsatzTV.Application.Libraries.Queries
@inject IDialogService _dialog
@inject IMediator _mediator
Library Paths
Path
@context.Path
Add Library Path
@code {
[Parameter]
public int Id { get; set; }
private IList _libraryPaths;
protected override async Task OnParametersSetAsync() => await LoadLibraryPaths();
private async Task LoadLibraryPaths() =>
_libraryPaths = await _mediator.Send(new GetLocalLibraryPaths(Id));
private async Task DeleteLibraryPath(LocalLibraryPathViewModel libraryPath)
{
int count = await _mediator.Send(new CountMediaItemsByLibraryPath(libraryPath.Id));
var parameters = new DialogParameters
{
{ "EntityType", "library path" },
{ "EntityName", libraryPath.Path },
{ "DetailText", $"This library path contains {count} media items." },
{ "DetailHighlight", count.ToString() }
};
var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.ExtraSmall };
IDialogReference dialog = _dialog.Show("Delete Library Path", parameters, options);
DialogResult result = await dialog.Result;
if (!result.Cancelled)
{
await _mediator.Send(new DeleteLocalLibraryPath(libraryPath.Id));
await LoadLibraryPaths();
}
}
}