using NetinaShop.Domain.Entities.Warehouses; namespace NetinaShop.Repository.Handlers.Warehouses; public class GetShippingQueryHandler : IRequestHandler { private readonly IRepositoryWrapper _repositoryWrapper; public GetShippingQueryHandler(IRepositoryWrapper repositoryWrapper) { _repositoryWrapper = repositoryWrapper; } public async Task Handle(GetShippingQuery request, CancellationToken cancellationToken) { var shippingMethod = await _repositoryWrapper.SetRepository().TableNoTracking.Where(b => b.Id == request.Id) .Select(ShippingMapper.ProjectToSDto) .FirstOrDefaultAsync(cancellationToken); if (shippingMethod == null) throw new AppException("Shipping method not found", ApiResultStatusCode.NotFound); return shippingMethod; } }