示例#1
0
        public void AddContentType(Data.Guid siteGuid, CmsContentType type)
        {
            if (String.IsNullOrEmpty(type.Guid))
                type.Guid = Data.Guid.Create().Value;

            if (!type.IsGlobalType)
                type.SubscriptionId = siteGuid.Value;

            //make sure this name doesn't already exist
            CmsContentTypeDao dao = new CmsContentTypeDao();

            CmsContentType existing = dao.FindBySiteAndName(type.SubscriptionId, type.Name);
            if (existing != null)
                throw new ArgumentException("This type name already exists and may not be used again.");

            using (Transaction tx = new Transaction())
            {
                dao.Save<CmsContentType>(type);
                tx.Commit();
            }

            type = GetContentType(type.Guid);
        }
示例#2
0
        public void AddContentTypeField(CmsContentType type, CmsContentTypeField field)
        {
            CmsContentTypeDao dao = new CmsContentTypeDao();
            field.Parent = type;

            using (Transaction tx = new Transaction())
            {
                dao.Save<CmsContentTypeField>(field);
                tx.Commit();
            }
        }
示例#3
0
 public void Save(CmsContentType type)
 {
     CmsContentTypeDao dao = new CmsContentTypeDao();
     using (Transaction tx = new Transaction())
     {
         dao.Save<CmsContentType>(type);
         tx.Commit();
     }
 }