private async void HandleBuy() { List <Ticket> tickets = new List <Ticket>(); bought = true; loading = true; foreach (var seat in choosenSeats) { tickets.Add(new Ticket { Id = MiniGuids.MiniGuid.NewGuid(), ForDateId = PlayDateTime.Id, Seat = seat.Seat }); PlayDateTime.SeatsTaken.Add(seat.Seat); } Console.WriteLine($"Update PlayDatetime: {PlayDateTime.Id}"); await PlayDateTimeRepo.Update(PlayDateTime); Console.WriteLine($"Add tickets:"); await TicketRepo.Add(tickets); tickets.ForEach(x => Console.WriteLine($"---- Id: {x.Id}")); await Task.Delay(2000); loading = false; StateHasChanged(); _ = OnClosed.InvokeAsync(this); }
public ActionResult EnterNew(AddTicketViewModel model) { Ticket ticket = new Ticket { Name = model.Name, Numbers = new int[6] { model.Numbers1, model.Numbers2, model.Numbers3, model.Numbers4, model.Numbers5, model.Numbers6 } }; TicketRepo.Add(ticket); return(View("DisplayTicket", TicketRepo.GetAll().LastOrDefault())); //if !IsValid: return View(model); }
//CREATE TICKET public void createTicket(CreateTicketViewModel model, string userId) { TicketType ticketType = new TicketType(model.TicketTypeName); TicketPriority ticketPriority = new TicketPriority(model.Priority); TicketTypeRepo.Add(ticketType); TicketPriorityRepo.Add(ticketPriority); Ticket ticket = new Ticket(model.Title, model.Description, DateTime.Now, model.ProjectId, ticketType.Id, ticketPriority.Id, userId); TicketRepo.Add(ticket); var copyTicket = TicketRepo.GetEntity(x => x.Id == ticket.Id); TicketHistory history = new TicketHistory(copyTicket.Id, "property", model.Description, model.Description, true, userId); TicketHistoryRepo.Add(history); }
public void AddTicket(Ticket ticket) => TicketRepo.Add(ticket);
public void AddTicket(Ticket ticket) { if (ticket != null) _repo.Add(ticket); }