コード例 #1
0
        public void AddEventSeats(Dictionary <string, Day> days, Event conEvent, string majorActivity)
        {
            if (EventSeats == null)
            {
                EventSeats = new List <EventSeatViewModel>();
            }

            var vm = EventSeats.FirstOrDefault(x => x.EventId == conEvent.Id);

            if (vm == null)
            {
                vm = new EventSeatViewModel
                {
                    EventId = conEvent.Id
                };
                EventSeats.Add(vm);
            }

            var date = days.ContainsKey(conEvent.ConventionDayId)
                ? days[conEvent.ConventionDayId].Date
                : new LocalDate(1, 1, 1);
            var time          = conEvent.TimeSlot != null ? conEvent.TimeSlot.From : new LocalTime(0, 0);
            var localDateTime = new LocalDateTime(
                date.Year,
                date.Month,
                date.Day,
                time.Hour,
                time.Minute);

            vm.Major      = majorActivity;
            vm.EventTime  = localDateTime;
            vm.TotalSeats = conEvent.Size.Max.HasValue ? (int)conEvent.Size.Max.Value : 0;
        }
コード例 #2
0
        public void AddEventTakenSeat(string eventId)
        {
            var seats = EventSeats.FirstOrDefault(x => x.EventId == eventId);

            seats.TakenSeats++;
        }