|
|
|
|
@ -3,9 +3,9 @@
@@ -3,9 +3,9 @@
|
|
|
|
|
@using ErsatzTV.Application.MediaCards.Queries |
|
|
|
|
@using ErsatzTV.Application.MediaCollections |
|
|
|
|
@using ErsatzTV.Application.MediaCollections.Commands |
|
|
|
|
@using ErsatzTV.Application.Playouts.Commands |
|
|
|
|
@using Microsoft.AspNetCore.WebUtilities |
|
|
|
|
@using Microsoft.Extensions.Primitives |
|
|
|
|
@using Unit = LanguageExt.Unit |
|
|
|
|
@inject NavigationManager NavigationManager |
|
|
|
|
@inject IMediator Mediator |
|
|
|
|
@inject ILogger<Search> Logger |
|
|
|
|
@ -75,21 +75,14 @@
@@ -75,21 +75,14 @@
|
|
|
|
|
if (!result.Cancelled && result.Data is MediaCollectionViewModel collection) |
|
|
|
|
{ |
|
|
|
|
var request = new AddMovieToCollection(collection.Id, movie.MovieId); |
|
|
|
|
Either<BaseError, CollectionUpdateResult> addResult = await Mediator.Send(request); |
|
|
|
|
Either<BaseError, Unit> addResult = await Mediator.Send(request); |
|
|
|
|
addResult.Match( |
|
|
|
|
Left: error => |
|
|
|
|
{ |
|
|
|
|
Snackbar.Add($"Unexpected error adding movie to collection: {error.Value}"); |
|
|
|
|
Logger.LogError("Unexpected error adding movie to collection: {Error}", error.Value); |
|
|
|
|
}, |
|
|
|
|
Right: async collectionUpdateResult => |
|
|
|
|
{ |
|
|
|
|
foreach (int playoutId in collectionUpdateResult.ModifiedPlayoutIds) |
|
|
|
|
{ |
|
|
|
|
await Channel.WriteAsync(new BuildPlayout(playoutId, true)); |
|
|
|
|
} |
|
|
|
|
Snackbar.Add($"Added {movie.Title} to collection {collection.Name}", Severity.Success); |
|
|
|
|
}); |
|
|
|
|
Right: _ => Snackbar.Add($"Added {movie.Title} to collection {collection.Name}", Severity.Success)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -103,21 +96,14 @@
@@ -103,21 +96,14 @@
|
|
|
|
|
if (!result.Cancelled && result.Data is MediaCollectionViewModel collection) |
|
|
|
|
{ |
|
|
|
|
var request = new AddShowToCollection(collection.Id, show.TelevisionShowId); |
|
|
|
|
Either<BaseError, CollectionUpdateResult> addResult = await Mediator.Send(request); |
|
|
|
|
Either<BaseError, Unit> addResult = await Mediator.Send(request); |
|
|
|
|
addResult.Match( |
|
|
|
|
Left: error => |
|
|
|
|
{ |
|
|
|
|
Snackbar.Add($"Unexpected error adding show to collection: {error.Value}"); |
|
|
|
|
Logger.LogError("Unexpected error adding show to collection: {Error}", error.Value); |
|
|
|
|
}, |
|
|
|
|
Right: async collectionUpdateResult => |
|
|
|
|
{ |
|
|
|
|
foreach (int playoutId in collectionUpdateResult.ModifiedPlayoutIds) |
|
|
|
|
{ |
|
|
|
|
await Channel.WriteAsync(new BuildPlayout(playoutId, true)); |
|
|
|
|
} |
|
|
|
|
Snackbar.Add($"Added {show.Title} to collection {collection.Name}", Severity.Success); |
|
|
|
|
}); |
|
|
|
|
Right: _ => Snackbar.Add($"Added {show.Title} to collection {collection.Name}", Severity.Success)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|