public async Task <Core.Domain.Passenger> Handle(GetPassengerByIdQuery request, CancellationToken cancellationToken) { var passenger = await _passengerRepository.GetAsync(request.PassengerId); if (passenger is null) { throw new ArgumentNullException($"Passenger with {request.PassengerId} not exist"); } return(passenger); }
public static async Task <Passenger> GetOrFailAsync(this IPassengerRepository repository, Guid userId) { var passenger = await repository.GetAsync(userId); if (passenger == null) { throw new Exception($"Passenger with id '{userId}' doesn't exists."); } return(passenger); }
public async Task <PassengerDetailsDto> GetAsync(Guid userId) { var passenger = await _passengerRepository.GetAsync(userId); return(_mapper.Map <PassengerDetailsDto>(passenger)); }