Пример #1
0
        public AirportViewModel CreateAirportRequest(AirportPostModel model)
        {
            if (string.IsNullOrWhiteSpace(model.Flight))
            {
                throw new Exception("Invalid flight");
            }
            if (model.FlightNumber <= 0)
            {
                throw new Exception("Invalid number of flight");
            }
            var airportModel = _mapper.Map <AirportModel>(model);

            var CreatedAirport = _airportService.CreateAirport(airportModel);

            return(_mapper.Map <AirportViewModel>(CreatedAirport));
        }