public IActionResult GetKeyByQuery([FromQuery] string pattern, int pageNumber, int pageSize) { try { var res = _keysService.GetKeyByQuery(pattern, pageNumber, pageSize); if (res == null) { return(NotFound()); } var results = new { Keys = res, res.TotalCount, res.TotalPages, res.HasNextPage, res.HasPreviousPage }; return(Ok(results)); } catch (Exception e) { return(BadRequest(e)); } }