コード例 #1
0
        ///<summary>Delete an article based on ID
        ///</summary>
        ///<param name="articleId"></param>
        public static void DeleteArticle(int articleId)
        {
            //get the article
            var a           = GetArticle(articleId);
            var cntTaxonomy = new Taxonomy.Content();

            //delete the content item
            cntTaxonomy.DeleteContentItem(a);
            //delete the article
            DataProvider.Instance().DeleteArticle(articleId);
        }
コード例 #2
0
        ///<summary>Delete all articles based on a moduleid
        ///</summary>
        ///<param name="moduleId"></param>
        public static void DeleteArticles(int moduleId)
        {
            //also need to delete the Content Items
            var cntTaxonomy = new Taxonomy.Content();

            //for each article in this module
            foreach (Article a in GetArticles(moduleId))
            {
                //delete the content items for these articles
                cntTaxonomy.DeleteContentItem(a);
            }

            DataProvider.Instance().DeleteArticles(moduleId);
        }
コード例 #3
0
        ///<summary>Save the article, checks if we are creating new, or updating an existing
        ///</summary>
        ///<param name="a"></param>
        ///<param name="tabId"></param>
        ///<returns></returns>
        public static int SaveArticle(Article a, int tabId)
        {
            if (a.ArticleId < 1)
            {
                a.ArticleId = DataProvider.Instance().AddArticle(a);

                var cntTaxonomy    = new Taxonomy.Content();
                var objContentItem = cntTaxonomy.CreateContentItem(a, tabId);

                a.ContentItemId = objContentItem.ContentItemId;
                SaveArticle(a, tabId);
            }
            else
            {
                DataProvider.Instance().UpdateArticle(a);
                var cntTaxonomy = new Taxonomy.Content();
                cntTaxonomy.UpdateContentItem(a, tabId);
            }
            return(a.ArticleId);
        }