Beispiel #1
0
        public ActionResult GetRedirects(int page = 1, int limit = 20, string type = null, string text = null, Guid?rootNodeKey = null)
        {
            try {
                // Initialize the search options
                RedirectsSearchOptions options = new() {
                    Page        = page,
                    Limit       = limit,
                    Type        = EnumUtils.ParseEnum(type, RedirectTypeFilter.All),
                    Text        = text,
                    RootNodeKey = rootNodeKey
                };

                // Make the search for redirects via the redirects service
                RedirectsSearchResult result = _redirects.GetRedirects(options);

                // Map the result for the API
                return(new JsonResult(_backOffice.Map(result)));
            } catch (RedirectsException ex) {
                if (!ex.Is404)
                {
                    _logger.LogError(ex, ex.Message);
                }

                // Generate the error response
                return(Error(ex));
            }
        }
Beispiel #2
0
 public object GetRedirects(int page = 1, int limit = 20, string type = null, string text = null, int?rootNodeId = null)
 {
     try {
         return(_redirects.GetRedirects(page, limit, type, text, rootNodeId));
     } catch (RedirectsException ex) {
         return(Request.CreateResponse(JsonMetaResponse.GetError(HttpStatusCode.InternalServerError, ex.Message)));
     }
 }