20 lines
625 B
C#
20 lines
625 B
C#
using MediatR;
|
|
using Modules.Library.Application.Gateways;
|
|
|
|
namespace Modules.Library.Application.Commands.Anime.Season;
|
|
|
|
public class CreateSeasonCommand : IRequest<Guid>
|
|
{
|
|
public Guid TitleId { get; set; }
|
|
}
|
|
|
|
public class CreateSeasonCommandHandler(IAnimeTitleGateway titleGateway) : IRequestHandler<CreateSeasonCommand, Guid>
|
|
{
|
|
public async Task<Guid> Handle(CreateSeasonCommand request, CancellationToken cancellationToken)
|
|
{
|
|
var title = await titleGateway.GetById(request.TitleId);
|
|
var season = title.AddSeason();
|
|
await titleGateway.Update(title);
|
|
return season.Id;
|
|
}
|
|
} |