public async Task <IActionResult> PutFlight([FromRoute] int id, [FromBody] FlightDetailedDTO flight)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != flight.FlightId)
            {
                return(BadRequest());
            }

            _context.Entry(_mapper.Map <Flight>(flight)).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FlightExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PostFlight([FromBody] FlightDetailedDTO flight)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var actualFlight = _mapper.Map <Flight>(flight);

            _context.Flights.Add(actualFlight);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetFlight", new { id = actualFlight.FlightId }, flight));
        }