Пример #1
0
        public IActionResult CreateAirport([FromBody] Airport airport)
        {
            var response = new PostAirportResponse();

            try
            {
                response = _airportService.PostAirport(new PostAirportRequest {
                    NewAirport = airport
                });
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }

            if (response.IsSuccessful)
            {
                return(Ok(response.Message));
            }
            else
            {
                return(BadRequest(response.Message));
            }
        }