Пример #1
0
 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));
        }