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