Ejemplo n.º 1
0
        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;
            }
        }
Ejemplo n.º 2
0
        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;
            }
        }