Example #1
0
        public BorgerDkArticleShortDescription GetArticleIdFromUrl(string url)
        {
            try {
                // Make the request to the Borger.dk endpoint
                ArticleShortDescription description = _client.GetArticleIDByUrl(url);

                // Wrap the description
                return(new BorgerDkArticleShortDescription(description));
            } catch (Exception ex) {
                if (ex.Message.EndsWith(" has been marked as not exportable."))
                {
                    throw new BorgerDkNotExportableException(url, ex);
                }

                if (ex.Message.StartsWith("No article found with url "))
                {
                    throw new BorgerDkNotFoundException(url, ex);
                }

                throw;
            }
        }
        public int GetArticleIdFromUrl(string url)
        {
            ArticleShortDescription desc = _client.GetArticleIDByUrl(url);

            return(desc == null ? 0 : desc.ArticleID);
        }