Пример #1
0
        public async Task <ActionResult <PassengerDto> > GetPassengerByName(string name)
        {
            try
            {
                var result = await _passengerRepository.GetPassengerByName(name);

                var mappedResult = _mapper.Map <PassengerDto>(result);
                if (result == null)
                {
                    return(NotFound($"There is no passenger with name:{name}"));
                }
                return(Ok(HateoasMainLinksPassenger(mappedResult)));
            }
            catch (Exception e)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"database failed {e.Message}"));
            }
        }