public async Task <IActionResult> GetTickets() { var tickets = await _repo.GetTickets(); if (tickets == null) { return(BadRequest("Could not load all tickets")); } return(Ok(tickets)); }
public async Task <IActionResult> GetAllTickets(int userId, TicketsForDetailedDto ticketsForDetailedDto) { if (userId != int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value)) { return(Unauthorized()); } var clientFromRepo = await _repo.GetClient(userId); //if(!clientFromRepo.Tickets.Any(t => t.Id == id )) // return Unauthorized(); var ticketFromRepo = await _repo.GetTickets(); var ticketToReturn = _mapper.Map <IEnumerable <TicketsForDetailedDto> >(ticketFromRepo); return(Ok(ticketToReturn)); }