20 lines
659 B
C#
20 lines
659 B
C#
using MediatR;
|
|
using Modules.Library.Application.Gateways;
|
|
|
|
namespace Modules.Library.Application.Commands.Anime.Title;
|
|
|
|
public class DeleteAnimeTitleCommand : IRequest<Unit>
|
|
{
|
|
public Guid TitleId { get; set; }
|
|
}
|
|
|
|
public class DeleteAnimtTitleCommandHandler(IAnimeTitleGateway titleGateway, ILanguageGateway languageGateway) : IRequestHandler<DeleteAnimeTitleCommand, Unit>
|
|
{
|
|
public async Task<Unit> Handle(DeleteAnimeTitleCommand request, CancellationToken cancellationToken)
|
|
{
|
|
var title = await titleGateway.GetById(request.TitleId);
|
|
title.Delete();
|
|
await titleGateway.Update(title);
|
|
return Unit.Value;
|
|
}
|
|
} |