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));
     }
 }
示例#2
0
        public IActionResult Create(Ticket ticket)
        {
            var createdTicket = ticketsService.Create(ticket);

            return(Ok(createdTicket));
        }
示例#3
0
        public ActionResult <Ticket> Create(Ticket book)
        {
            _ticketsService.Create(book);

            return(CreatedAtRoute("GetBook", new { id = book.Id.ToString() }, book));
        }
示例#4
0
        public ActionResult <Ticket> Create(Ticket m)
        {
            _ticketService.Create(m);

            return(CreatedAtRoute("GetTicket", new { id = m.Id.ToString() }, m));
        }