Style: C# 12 Primary constructor

This commit is contained in:
Kamigen
2024-03-30 20:59:17 -04:00
parent 786c65410d
commit 8f58311283
50 changed files with 267 additions and 449 deletions

View File

@@ -2,7 +2,7 @@
namespace Hutopy.Application.Stripe.Commands;
public record CreateSessionCheckoutCommand : IRequest<string>
public abstract record CreateSessionCheckoutCommand : IRequest<string>
{
public required int Price { get; init; }
@@ -10,21 +10,16 @@ public record CreateSessionCheckoutCommand : IRequest<string>
}
public class CreateSessionCheckoutCommandHandler : IRequestHandler<CreateSessionCheckoutCommand, string>
public class CreateSessionCheckoutCommandHandler(
IApplicationDbContext context,
IStripeService stripeService)
: IRequestHandler<CreateSessionCheckoutCommand, string>
{
private readonly IApplicationDbContext _context;
private readonly IStripeService _stripeService;
public CreateSessionCheckoutCommandHandler(IApplicationDbContext context, IStripeService stripeService)
{
_context = context;
_stripeService = stripeService;
}
private readonly IApplicationDbContext _context = context;
public async Task<string> Handle(CreateSessionCheckoutCommand request, CancellationToken cancellationToken)
{
var stripeSecret = await _stripeService.CreateCheckoutSession(request.Price, request.Currency);
var stripeSecret = await stripeService.CreateCheckoutSession(request.Price, request.Currency);
return stripeSecret;
}