Beispiel #1
0
 public IActionResult Get(int id)
 {
     if (ticketsService.Contains(id))
     {
         var ticket = ticketsService.Get(id);
         return(Ok(ticket));
     }
     else
     {
         return(NotFound($"Unable to find ticket with id {id}"));
     }
 }
 public ActionResult <Ticket> Get()
 {
     try
     {
         string nameIdentifier = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
         if (nameIdentifier != null)
         {
             return(Ok(_ticketsService.Get(nameIdentifier)));
         }
         else
         {
             throw new UnauthorizedAccessException("Unauthorized");
         }
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Beispiel #3
0
 public ActionResult <List <Ticket> > Get()
 {
     return(_ticketsService.Get());
 }
 public ActionResult <List <Ticket> > Get() =>
 _ticketsService.Get();