コード例 #1
0
        public async Task <IActionResult> GetEventTickets(int eventId)
        {
            EventTicketsViewModel model;

            Dictionary <Event, List <Ticket> > dic = new Dictionary <Event, List <Ticket> >();

            ViewData["Title"] = localizer["ticketsTitle"];

            var @event = await eventsService.GetEventById(eventId);

            var eventTickets = await ticketsService.GetTicketsByEventId(eventId);

            var eventVenue = await venuesService.GetVenueById(@event.VenueId);

            var eventCity = await citiesService.GetCityById(eventVenue.CityId);

            var sellersIdsByEvent = eventTickets.AsEnumerable().Select(et => et.SellerId).ToList();

            var sellersOfTicketsByEvent = await usersAndRolesService.GetUsersByListOfId(sellersIdsByEvent);

            dic.Add(@event, eventTickets);

            model = new EventTicketsViewModel
            {
                eventTickets = dic,
                Venue        = eventVenue,
                City         = eventCity,
                Sellers      = sellersOfTicketsByEvent
            };


            return(View("EventTickets", model));
        }