private async Task<Ticket> UpdateTicketHolder(int orderID, TicketSeatHolderApiModel item) { var ticket = await ticketRepository.RetrieveAsync(item.TicketID); if (ticket.OrderID != orderID) { return null; } ticket.FirstName = item.FirstName; ticket.MiddleInitial = item.MiddleInitial; ticket.LastName = item.LastName; //only update arrival if a cashier submitted this if (User.IsInRole("Cashier")) { ticket.ArrivalTime = item.ArrivalTime; } await ticketRepository.UpdateAsync(ticket, ticket.TicketID); return ticket; }
private static List<TicketSeatHolderApiModel> BuildTicketHolders(List<Ticket> tickets) { var response = new List<TicketSeatHolderApiModel>(); foreach (var x in tickets) { var ticket = new TicketSeatHolderApiModel { AgeGroup = x.TicketPrice.EventAgeGroup.Name, DiscountName = x.TicketDiscount?.Name, FirstName = x.FirstName, MiddleInitial = x.MiddleInitial, LastName = x.LastName, TicketID = x.TicketID, TicketSeatID = x.TicketSeat.TicketSeatID, Location = x.TicketSeat.TicketArea.Name, HasArrived = x.ArrivalTime.HasValue, ArrivalTime = x.ArrivalTime }; if (x.TicketSeat.TicketRowID.HasValue) { ticket.Location += " " + x.TicketSeat.TicketRow.TicketSection.Name + " " + x.TicketSeat.TicketRow.Designation + " " + x.TicketSeat.SeatNumber; } response.Add(ticket); } return response; }