namespace NetinaShop.Core.EntityServices.ReviewHandlers; public class ConfirmReviewCommandHandler : IRequestHandler { private readonly IRepositoryWrapper _repositoryWrapper; public ConfirmReviewCommandHandler(IRepositoryWrapper repositoryWrapper) { _repositoryWrapper = repositoryWrapper; } public async Task Handle(ConfirmReviewCommand request, CancellationToken cancellationToken) { var review = await _repositoryWrapper.SetRepository().TableNoTracking .FirstOrDefaultAsync(r => r.Id == request.Id, cancellationToken); if (review == null) throw new AppException("Review not found", ApiResultStatusCode.NotFound); review.ConfirmReview(); _repositoryWrapper.SetRepository().Update(review); await _repositoryWrapper.SaveChangesAsync(cancellationToken); return true; } }