17 lines
736 B
C#
17 lines
736 B
C#
using Netina.Domain.Entities.Warehouses;
|
|
|
|
namespace Netina.Repository.Handlers.Warehouses;
|
|
|
|
public class GetShippingQueryHandler(IRepositoryWrapper repositoryWrapper)
|
|
: IRequestHandler<GetShippingQuery, ShippingSDto>
|
|
{
|
|
public async Task<ShippingSDto> Handle(GetShippingQuery request, CancellationToken cancellationToken)
|
|
{
|
|
var shippingMethod = await repositoryWrapper.SetRepository<Shipping>().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;
|
|
}
|
|
} |