public ActionResult <PaginationResponse <List <Models.Ticket> > > GetTickets([FromQuery(Name = "age")] string?age, [FromQuery(Name = "from")] DateTime?fromDate, [FromQuery(Name = "to")] DateTime?toDate, [FromQuery(Name = "page")] int?page, [FromQuery(Name = "pageSize")] int?pageSize) { try { if (!_cache.TryGetValue("Tickets", out List <Models.Ticket> tickets)) { _cache.Set("Tickets", tickets, TimeSpan.FromSeconds(600)); } if (page != null || pageSize != null) { return(Ok(new PaginationResponse <Models.Ticket>((_ticket.GetTickets(age, fromDate, toDate)), page, pageSize))); } return(Ok(new OkResponse <List <Models.Ticket> >(_ticket.GetTickets(age, fromDate, toDate)))); } catch (Exception e) { return(BadRequest(new ErrorResponse(e.Message, new List <string>() { "age", "from", "to", "page", "pageSize" }))); } }