Esempio n. 1
0
        private HierarchicalTaxon CreateCategory(string categoryName)
        {
            HierarchicalTaxon taxon = SFTaxonomyManager.CreateTaxon <HierarchicalTaxon>();

            taxon.Name    = categoryName;
            taxon.Title   = categoryName;
            taxon.UrlName = Regex.Replace(categoryName.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-");

            _categories.Taxa.Add(taxon);
            SFTaxonomyManager.SaveChanges();

            return(taxon);
        }
Esempio n. 2
0
        private FlatTaxon CreateTag(string tagName)
        {
            FlatTaxon taxon = SFTaxonomyManager.CreateTaxon <FlatTaxon>();

            taxon.Name    = tagName;
            taxon.Title   = tagName;
            taxon.UrlName = Regex.Replace(tagName.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-");

            _tags.Taxa.Add(taxon);
            SFTaxonomyManager.SaveChanges();

            return(taxon);
        }