public async Task <ActionResult> Edit(int id)
        {
            ViewBag.VenueId = id;
            var metaData = await _venueMetaData.GetVenueMetaData(id) ?? new VenueMetaData
            {
                VenueId = id, Data = new
                {
                }
            };

            return(View(metaData));
        }
Exemple #2
0
        public async Task <ActionResult> Index(String concertId)
        {
            // Check ConcertId
            int intConcertId;

            Int32.TryParse(concertId, out intConcertId);

            if (intConcertId == 0)
            {
                return(RedirectToAction("Index", "Home"));
            }

            // Check Concert Found
            var selectedConcert = _mainRepository.ConcertDbContext.GetConcertById(intConcertId);

            if (selectedConcert == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            // Check Venue
            selectedConcert.Venue = _mainRepository.VenuesDbContext.GetVenueByVenueId(selectedConcert.VenueId);
            if (selectedConcert.Venue == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            // Build Venue Seat Sections
            selectedConcert.Venue.VenueSeatSections = new List <SeatSection>();
            selectedConcert.Venue.VenueSeatSections.AddRange(_mainRepository.VenuesDbContext.GetSeatMapForVenue(selectedConcert.VenueId));

            // Get Ticket Levels
            var ticketLevelsForSection = _mainRepository.ConcertTicketDbContext.GetTicketLevelById(selectedConcert.ConcertId);

            foreach (var seatSection in selectedConcert.Venue.VenueSeatSections)
            {
                var ticketLevel = ticketLevelsForSection.FirstOrDefault(tl => tl.SeatSectionId == seatSection.SeatSectionId);

                if (ticketLevel != null)
                {
                    seatSection.TicketLevelId = ticketLevel.TicketLevelId;
                    seatSection.TicketPrice   = ticketLevel.TicketPrice;

                    switch (Convert.ToInt32(seatSection.TicketPrice))
                    {
                    case 55:
                        seatSection.TicketLevelDescription = "Sections 219-221";
                        break;

                    case 60:
                        seatSection.TicketLevelDescription = "Sections 218-214";
                        break;

                    case 65:
                        seatSection.TicketLevelDescription = "Sections 222-226";
                        break;

                    case 70:
                        seatSection.TicketLevelDescription = "Sections 210-213";
                        break;

                    case 75:
                        seatSection.TicketLevelDescription = "Sections 201-204";
                        break;

                    case 80:
                        seatSection.TicketLevelDescription = "Sections 114-119";
                        break;

                    case 85:
                        seatSection.TicketLevelDescription = "Sections 120-126";
                        break;

                    case 90:
                        seatSection.TicketLevelDescription = "Sections 104-110";
                        break;

                    case 95:
                        seatSection.TicketLevelDescription = "Sections 111-113";
                        break;

                    case 100:
                        seatSection.TicketLevelDescription = "Sections 101-103";
                        break;
                    }
                }
            }

            ViewBag.VenueMetaData = await _venueMetaData.GetVenueMetaData(selectedConcert.VenueId);

            return(View(selectedConcert));
        }