public ActionResult <Ticket> Create([FromBody] Ticket Ticket) { try { string nameIdentifier = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; if (nameIdentifier != null) { Ticket.creatorEmail = nameIdentifier; return(Ok(_ticketsService.Create(Ticket))); } else { throw new UnauthorizedAccessException("Unauthorized"); } } catch (Exception e) { return(BadRequest(e.Message)); } }
public IActionResult Create(Ticket ticket) { var createdTicket = ticketsService.Create(ticket); return(Ok(createdTicket)); }
public ActionResult <Ticket> Create(Ticket book) { _ticketsService.Create(book); return(CreatedAtRoute("GetBook", new { id = book.Id.ToString() }, book)); }
public ActionResult <Ticket> Create(Ticket m) { _ticketService.Create(m); return(CreatedAtRoute("GetTicket", new { id = m.Id.ToString() }, m)); }