public IActionResult Update(int id, TicketRequest ticketRequest) { try { if (!ticketsService.Contains(id)) { return(NotFound("Event not found!")); } Ticket ticketToUpdate = ticketRequest.ToTicket(); ticketToUpdate.Id = id; ticketsService.Update(ticketToUpdate); } catch (Exception) { return(BadRequest("Check your request!")); } return(Ok()); }
public IActionResult Create(TicketRequest ticketRequest) { Ticket ticket = ticketsService.Create(ticketRequest.ToTicket()); return(Ok(ticket)); }