erminas.SmartAPI.CMS.Project.ContentClasses.ContentClass.CopyPreassignedKeywordsToCC C# (CSharp) Method

CopyPreassignedKeywordsToCC() private method

private CopyPreassignedKeywordsToCC ( IContentClass targetCC ) : void
targetCC IContentClass
return void
        private void CopyPreassignedKeywordsToCC(IContentClass targetCC)
        {
            try
            {
                List<IKeyword> keywordsToAssign =
                    PreassignedKeywords.Select(
                        x => targetCC.Project.Categories.GetByName(x.Category.Name).Keywords.GetByName(x.Name)).ToList();
                targetCC.PreassignedKeywords.Set(keywordsToAssign);
            } catch (Exception e)
            {
                throw new SmartAPIException(Session.ServerLogin,
                                            string.Format("Could not copy preassigned keywords for content class {0}",
                                                          Name), e);
            }
        }