Пример #1
0
        public IEnumerable <Passenger> ChangeSeats(SeatDTO seatDTO) // Use seatNumber or passenger name?
        {
            Passenger passenger1 = _passengerRepository.GetPassengerBySeatNumber(seatDTO.SeatNumber1);
            Passenger passenger2 = _passengerRepository.GetPassengerBySeatNumber(seatDTO.SeatNumber2);

            passenger1.SeatNumber = seatDTO.SeatNumber2;
            passenger2.SeatNumber = seatDTO.SeatNumber1;
            _passengerRepository.SaveChanges();
            List <Passenger> passengers = new List <Passenger>()
            {
                passenger1, passenger2
            };

            return(passengers);
        }