public string SyncSite() { //Set up the session data var common = CMS_Common.GetCommonInstance(Request.RequestContext); var user = common.CurrentUser; var store = common.ContentStore; //Get requested pages for sync var pages = Request.Form["pages"].Split('|'); //get schema to sync var schema = Request.Form["schema"]; //Schema service and sync request var schemaService = new IngeniuxCMService.SchemaDesignerServices(); var syncRequest = new IngeniuxCMService.SchemaSyncRequest(); var toSync = new List <IngeniuxCMService.SchemaSyncPageEntry>(); using (var session = store.OpenWriteSession(user)) { //check the schema id of each page foreach (var xid in pages) { var page = session.Site.Page(xid.Replace(" ", "")); //if the schema matches if (page.Schema.Id == schema) { toSync.Add(new IngeniuxCMService.SchemaSyncPageEntry { ID = xid }); } } } //Pages to sync var pageEntries = toSync; syncRequest.Pages = pageEntries.ToArray(); syncRequest.SchemaId = schema; //do the sync and get resutls var response = schemaService.SyncPagesToSchema(syncRequest); return(new JavaScriptSerializer().Serialize(response)); }
public string SyncSite() { //Set up the session data var common = CMS_Common.GetCommonInstance(Request.RequestContext); var user = common.CurrentUser; var store = common.ContentStore; //Get requested pages for sync var pages = Request.Form["pages"].Split('|'); //get schema to sync var schema = Request.Form["schema"]; //Schema service and sync request var schemaService = new IngeniuxCMService.SchemaDesignerServices(); var syncRequest = new IngeniuxCMService.SchemaSyncRequest(); var toSync = new List<IngeniuxCMService.SchemaSyncPageEntry>(); using (var session = store.OpenWriteSession(user)) { //check the schema id of each page foreach (var xid in pages) { var page = session.Site.Page(xid.Replace(" ", "")); //if the schema matches if (page.Schema.Id == schema) { toSync.Add(new IngeniuxCMService.SchemaSyncPageEntry { ID = xid }); } } } //Pages to sync var pageEntries = toSync; syncRequest.Pages = pageEntries.ToArray(); syncRequest.SchemaId = schema; //do the sync and get resutls var response = schemaService.SyncPagesToSchema(syncRequest); return new JavaScriptSerializer().Serialize(response); }