MyBookmark/Modules.Library.Application/Commands/Anime/Title/Properties/Preview/DeletePreviewCommand.cs
2024-09-23 03:00:50 +03:00

20 lines
656 B
C#

using MediatR;
using Modules.Library.Application.Gateways;
namespace Modules.Library.Application.Commands.Anime.Title.Properties.Preview;
public class DeletePreviewCommand : IRequest<Unit>
{
public Guid TitleId { get; set; }
}
public class DeletePreviewCommandHandler(IAnimeTitleGateway titleGateway) : IRequestHandler<DeletePreviewCommand, Unit>
{
public async Task<Unit> Handle(DeletePreviewCommand request, CancellationToken cancellationToken)
{
var title = await titleGateway.GetById(request.TitleId);
title.CommonProperties.DeletePreview();
await titleGateway.Update(title);
return Unit.Value;
}
}