|
|
|
|
@ -1,6 +1,8 @@
@@ -1,6 +1,8 @@
|
|
|
|
|
@using ErsatzTV.Application.MediaCollections |
|
|
|
|
@using Microsoft.Extensions.Caching.Memory |
|
|
|
|
@using ErsatzTV.Application.MediaCollections |
|
|
|
|
@using ErsatzTV.Application.MediaCollections.Queries |
|
|
|
|
@inject IMediator Mediator |
|
|
|
|
@inject IMemoryCache MemoryCache |
|
|
|
|
|
|
|
|
|
<MudDialog> |
|
|
|
|
<DialogContent> |
|
|
|
|
@ -46,12 +48,22 @@
@@ -46,12 +48,22 @@
|
|
|
|
|
|
|
|
|
|
private MediaCollectionViewModel _selectedCollection; |
|
|
|
|
|
|
|
|
|
protected override async Task OnParametersSetAsync() => |
|
|
|
|
protected override async Task OnParametersSetAsync() |
|
|
|
|
{ |
|
|
|
|
_collections = await Mediator.Send(new GetAllCollections()); |
|
|
|
|
if (MemoryCache.TryGetValue("AddToCollectionDialog.SelectedCollectionId", out int id)) |
|
|
|
|
{ |
|
|
|
|
_selectedCollection = _collections.SingleOrDefault(c => c.Id == id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private string FormatText() => $"Select the collection to add the {EntityType} {EntityName}"; |
|
|
|
|
|
|
|
|
|
private void Submit() => MudDialog.Close(DialogResult.Ok(_selectedCollection)); |
|
|
|
|
private void Submit() |
|
|
|
|
{ |
|
|
|
|
MemoryCache.Set("AddToCollectionDialog.SelectedCollectionId", _selectedCollection.Id); |
|
|
|
|
MudDialog.Close(DialogResult.Ok(_selectedCollection)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void Cancel() => MudDialog.Cancel(); |
|
|
|
|
|
|
|
|
|
|