22 lines
709 B
C#
22 lines
709 B
C#
using MediatR;
|
|
using Modules.Library.Application.Gateways;
|
|
|
|
namespace Modules.Library.Application.Commands.Anime.Title.Properties;
|
|
|
|
public class SetCountryCommand : IRequest<Unit>
|
|
{
|
|
public Guid TitleId { get; init; }
|
|
public string? Value { get; init; }
|
|
|
|
}
|
|
|
|
public class SetCountryCommandHandler(IAnimeTitleGateway titleGateway) : IRequestHandler<SetCountryCommand, Unit>
|
|
{
|
|
public async Task<Unit> Handle(SetCountryCommand request, CancellationToken cancellationToken)
|
|
{
|
|
var title = await titleGateway.GetById(request.TitleId, cancellationToken);
|
|
title.SetCountry(request.Value);
|
|
await titleGateway.Update(title, cancellationToken);
|
|
return Unit.Value;
|
|
}
|
|
} |