예제 #1
0
        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());
        }
예제 #2
0
        public IActionResult Create(TicketRequest ticketRequest)
        {
            Ticket ticket = ticketsService.Create(ticketRequest.ToTicket());

            return(Ok(ticket));
        }