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)); }
public async Task <IActionResult> RemoveVenue(int venueId, string returnUrl, string queryString) { var venue = await venuesService.GetVenueById(venueId); await venuesService.ChangeVenueStatus(venue, VenueStatuses.Removed); return(RedirectToTheSamePage(returnUrl, queryString)); }
public async Task <IActionResult> EditVenue(int id) { var venue = await venuesService.GetVenueById(id); var cities = await citiesService.GetCities(); var list = new SelectList(cities, "Id", "Name"); ViewBag.Cities = list; if (venue != null) { return(View(venue)); } return(NotFound()); }
public async Task <IActionResult> EventWithTickets(int eventId) { var currentEvent = await eventsService.GetEventById(eventId); var eventTickets = ticketsService.GetTicketsByEventIdAndStatus(eventId, TicketStatuses.Selling); currentEvent.Venue = await venuesService.GetVenueById(currentEvent.VenueId); currentEvent.Venue.City = await citiesService.GetCityById(currentEvent.Venue.CityId); var ticketsList = new List <EventTickets>(); foreach (var ticket in eventTickets) { var seller = await userManager.FindByIdAsync(ticket.SellerId); ticketsList.Add( new EventTickets { TicketId = ticket.Id, SellerName = seller.UserName, Price = ticket.Price, SellerNotes = ticket.SellerNotes } ); } ; var model = new EventWithTicketsViewModel { Event = currentEvent, Tickets = ticketsList }; return(View(model)); }