public async Task <ActionResult <Ticket> > GetTicketById(int ticketid) { AnonymousUserFacade facade = new AnonymousUserFacade(false); Ticket result = null; try { result = await Task.Run(() => facade.GetTicketById(ticketid)); } catch (Exception ex) { return(StatusCode(400, $"{{ error: can't get ticket by id \"{ex.Message}\" }}")); } if (result == null) { return(StatusCode(204, "{There is no ticket by this id }")); } return(Ok(result)); }