using MediatR; using Modules.Library.Application.Gateways; namespace Modules.Library.Application.Commands.Anime.Title.Properties; public class SetCompletedCommand : IRequest { public Guid TitleId { get; set; } public bool Value { get; set; } } public class SetCompletedCommandHandler(IAnimeTitleGateway titleGateway) : IRequestHandler { public async Task Handle(SetCompletedCommand request, CancellationToken cancellationToken) { var title = await titleGateway.GetById(request.TitleId); if (request.Value) title.SetCompleted(); else title.SetNotCompleted(); await titleGateway.Update(title); return Unit.Value; } }