コード例 #1
0
        public async Task <List <Seat> > FindSeats(int id)
        {
            ViewingId = (int)id;

            var         seatIds = _context.Tickets.Where(x => x.ViewingId == id).Select(x => x.SeatId);
            int         salonId = _context.Viewings.Find(id).SalonId;
            List <Seat> seats   = await _context.Seats.Where(x => seatIds.Contains(x.SeatId)).ToListAsync <Seat>();

            Seats = await _context.Seats.Where(x => x.SalonId == salonId).ToListAsync();

            _context.Entry(Seats.First()).Reference(v => v.Salon).Load();

            foreach (var item in Seats)
            {
                item.ViewingId = id;
                foreach (var seat in seats)
                {
                    if (item.SeatId == seat.SeatId)
                    {
                        item.Booked = true;
                    }
                }
            }

            return(Seats);
        }
コード例 #2
0
        public void ClickButton(SeatModel selected)
        {
            var seat = Seats.FirstOrDefault(x => x.Id == selected.Id);

            if (seat.Number != -1)
            {
                Seats.First(x => x.Id == selected.Id).Number = -1;
            }
            else
            {
                Seats.First(x => x.Id == selected.Id).Number = 1;
            }
        }
コード例 #3
0
 public Seat Seat(SeatId seatId)
 {
     return(Seats.First(x => x.Id.Equals(seatId)));
 }