Exemplo n.º 1
0
 public JsonResult Update(TemplateForm form)
 {
     if (ModelState.IsValid)
     {
         contentManager.Template.Update(form);
         return JsonNet(new {success = true,});
     }
     return JsonNet(new {success = false,});
 }
Exemplo n.º 2
0
        public void Update(TemplateForm form)
        {
            var template = Load(form.Id);

            template.AnalyticsKey = form.AnalyticsKey;

            // update all pages with this analytics key
            session.Advanced.DatabaseCommands.UpdateByIndex("PagesByTemplate",
                                                            new IndexQuery
                                                                {
                                                                    Query = "TemplateId:" + template.Id
                                                                }, new[]
                                                                       {
                                                                           new PatchRequest
                                                                               {
                                                                                   Type = PatchCommandType.Set,
                                                                                   Name = "AnalyticsKey",
                                                                                   Value = form.AnalyticsKey
                                                                               }
                                                                       }, false);
            session.SaveChanges();
        }