Exemple #1
0
        public async Task <ActionResult <PassengerDto> > GetPassengerByIdentificationNumber(long IdentificationNumber)
        {
            try
            {
                var result = await _passengerRepository.GetPassengerByIdentificationNumber(IdentificationNumber);

                var mappedResult = _mapper.Map <PassengerDto>(result);
                if (result == null)
                {
                    return(NotFound($"There is no passenger with Identificationnumber:{IdentificationNumber}"));
                }

                return(Ok(HateoasMainLinksPassenger(mappedResult)));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $" Database failed {e.Message}"));
            }
        }