public JsonResult Update(TemplateForm form) { if (ModelState.IsValid) { contentManager.Template.Update(form); return JsonNet(new {success = true,}); } return JsonNet(new {success = false,}); }
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(); }