public AuditoriumView(Auditorium auditorium, List <Seat> occupiedSeats) { Rows = new List <AuditoriumRow>(); for (var i = 0; i < auditorium.Rows; i++) { var row = new AuditoriumRow { Seats = new List <AuditoriumSeat>(), Number = i + 1 }; for (var j = 0; j < auditorium.Seats; j++) { var seat = new AuditoriumSeat { Row = row, SeatNumber = j + 1, IsFree = true }; seat.PropertyChanged += SeatOnPropertyChanged; row.Seats.Add(seat); } Rows.Add(row); } foreach (var seat in occupiedSeats) { Rows[seat.RowNumber - 1].Seats[seat.SeatNumber - 1].IsFree = false; } }
public AuditoriumView(Auditorium auditorium, List<Seat> occupiedSeats) { Rows = new List<AuditoriumRow>(); for (var i = 0; i < auditorium.Rows; i++) { var row = new AuditoriumRow { Seats = new List<AuditoriumSeat>(), Number = i + 1 }; for (var j = 0; j < auditorium.Seats; j++) { var seat = new AuditoriumSeat { Row = row, SeatNumber = j + 1, IsFree = true }; seat.PropertyChanged += SeatOnPropertyChanged; row.Seats.Add(seat); } Rows.Add(row); } foreach (var seat in occupiedSeats) { Rows[seat.RowNumber - 1].Seats[seat.SeatNumber - 1].IsFree = false; } }