public int create(templateCarrier carrier, string username, string password)
        {
            Authenticate(username, password);

            if (carrier.Id != 0)
            {
                throw new Exception("ID may not be specified when creating");
            }
            if (carrier == null)
            {
                throw new Exception("No carrier specified");
            }

            // Get the user
            umbraco.BusinessLogic.User user = GetUser(username, password);

            // Create template
            cms.businesslogic.template.Template template = cms.businesslogic.template.Template.MakeNew(carrier.Name, user);

            template.MasterTemplate = carrier.MastertemplateId;
            template.Alias          = carrier.Alias;
            template.Text           = carrier.Name;
            template.Design         = carrier.Design;
            template.Save();
            clearCachedTemplate(template);
            return(template.Id);
        }
        public void update(templateCarrier carrier, string username, string password)
        {
            if (carrier.Id == 0)
            {
                throw new Exception("ID must be specifed when updating");
            }
            if (carrier == null)
            {
                throw new Exception("No carrier specified");
            }

            cms.businesslogic.template.Template template;
            try
            {
                template = new cms.businesslogic.template.Template(carrier.Id);
            }
            catch (Exception)
            {
                throw new Exception("Template with ID " + carrier.Id + " not found");
            }

            template.MasterTemplate = carrier.MastertemplateId;
            template.Alias          = carrier.Alias;
            template.Text           = carrier.Name;
            template.Design         = carrier.Design;
            template.Save();


            clearCachedTemplate(template);
        }
示例#3
0
        public templateCarrier createTemplateCarrier(cms.businesslogic.template.Template template)
        {
            templateCarrier carrier = new templateCarrier();

            carrier.Id = template.Id;
            carrier.MastertemplateId = template.MasterTemplate;
            carrier.Alias            = template.Alias;
            carrier.Name             = template.Text;
            carrier.Design           = template.Design;
            return(carrier);
        }
示例#4
0
        public templateCarrier createTemplateCarrier(cms.businesslogic.template.Template template)
        {
            var carrier = new templateCarrier
            {
                Id = template.Id,
                MastertemplateId = template.MasterTemplate,
                Alias            = template.Alias,
                Name             = template.Text,
                Design           = template.Design,
                MasterPageFile   = template.MasterPageFile
            };

            return(carrier);
        }
示例#5
0
        public int create(templateCarrier carrier, string username, string password)
        {
            Authenticate(username, password);

            if (carrier.Id != 0) throw new Exception("ID may not be specified when creating");
            if (carrier == null) throw new Exception("No carrier specified");

            // Get the user
            umbraco.BusinessLogic.User user = GetUser(username, password);

            // Create template
            cms.businesslogic.template.Template template = cms.businesslogic.template.Template.MakeNew(carrier.Name, user);

            template.MasterTemplate = carrier.MastertemplateId;
            template.Alias = carrier.Alias;
            template.Text = carrier.Name;
            template.Design = carrier.Design;
            template.Save();
            clearCachedTemplate(template);
            return template.Id;
        }
示例#6
0
        public void update(templateCarrier carrier, string username, string password)
        {
            if (carrier.Id == 0) throw new Exception("ID must be specifed when updating");
            if (carrier == null) throw new Exception("No carrier specified");

            cms.businesslogic.template.Template template;
            try
            {
                template = new cms.businesslogic.template.Template(carrier.Id);
            }
            catch (Exception)
            {
                throw new Exception("Template with ID " + carrier.Id + " not found");
            }

            template.MasterTemplate = carrier.MastertemplateId;
            template.Alias = carrier.Alias;
            template.Text = carrier.Name;
            template.Design = carrier.Design;
            template.Save();


            clearCachedTemplate(template);
        }
示例#7
0
 public templateCarrier createTemplateCarrier(cms.businesslogic.template.Template template)
 {
     templateCarrier carrier = new templateCarrier();
     carrier.Id = template.Id;
     carrier.MastertemplateId = template.MasterTemplate;
     carrier.Alias = template.Alias;
     carrier.Name = template.Text;
     carrier.Design = template.Design;
     carrier.MasterPageFile = template.MasterPageFile;
     return carrier;
 }
 public templateCarrier createTemplateCarrier(cms.businesslogic.template.Template template)
 {
     var carrier = new templateCarrier
                         {
                             Id = template.Id,
                             MastertemplateId = template.MasterTemplate,
                             Alias = template.Alias,
                             Name = template.Text,
                             Design = template.Design,
                             MasterPageFile = template.MasterPageFile
                         };
     return carrier;
 }