MyBookmark/Modules.Library.Application/Commands/Anime/Title/Properties/Genre/SetGenreProportionCommand.cs
THE_KONDRAT 7b16d72329 ui and login
mongo => postgres
2024-11-03 16:08:39 +03:00

22 lines
797 B
C#

using MediatR;
using Modules.Library.Application.Gateways;
namespace Modules.Library.Application.Commands.Anime.Title.Properties.Genre;
public class SetGenreProportionCommand : IRequest<Unit>
{
public Guid TitleId { get; set; }
public Guid GenreId { get; set; }
public decimal? Proportion { get; set; }
}
public class SetGenreProportionCommandHandler(IAnimeTitleGateway titleGateway) : IRequestHandler<SetGenreProportionCommand, Unit>
{
public async Task<Unit> Handle(SetGenreProportionCommand request, CancellationToken cancellationToken)
{
var title = await titleGateway.GetById(request.TitleId);
title.CommonProperties.SetGenreProportion(request.GenreId, request.Proportion);
await titleGateway.Update(title);
return Unit.Value;
}
}