コード例 #1
0
ファイル: FlightService.cs プロジェクト: kutlueren/Simple-Air
        public async Task <ICollection <AirportResponseDto> > GetAirportsAsync(AirportRequestDto request)
        {
            if (request == null || string.IsNullOrEmpty(request.SearchKey))
            {
                throw new BusinessException("request or search key null.");
            }

            var airports = await _airportRepository.GetAirportsAsync(request.SearchKey);

            List <AirportResponseDto> airportResponseList = new List <AirportResponseDto>();

            _mapper.Map(airports, airportResponseList);

            return(airportResponseList);
        }
コード例 #2
0
        public async Task <IActionResult> GetAirports([FromBody] AirportRequestDto request)
        {
            var airports = await _flightService.GetAirportsAsync(request);

            return(Ok(airports));
        }