public dynamic GetContentInfo(int appId, int zoneId, string scope) { var appWrapper = new SxcAppWrapper(appId); var contentTypes = appWrapper.GetContentTypes(scope); var entities = appWrapper.GetEntities(); var templates = appWrapper.GetTemplates(); var dimensions = new string[] { appWrapper.GetCultureCode() }; return(new { ContentTypes = contentTypes.Select(c => new { Id = c.AttributeSetId, Name = c.Name, StaticName = c.StaticName, Templates = templates.Where(t => t.ContentTypeStaticName == c.StaticName).Select(t => new { Id = t.TemplateId, Name = t.Name }), Entities = entities.Where(e => e.Value.Type.AttributeSetId == c.AttributeSetId).Select(e => new DynamicEntity(e.Value, dimensions, null).ToDictionary()) }), TemplatesWithoutContentTypes = templates.Where(t => !string.IsNullOrEmpty(t.ContentTypeStaticName)).Select(t => new { Id = t.TemplateId, Name = t.Name }) }); }
public HttpResponseMessage ExportApp(int appId, int zoneId, bool includeContentGroups, bool resetAppGuid) { EnsureUserIsAdmin(); var appWrapper = new SxcAppWrapper(appId); var zipExport = new ZipExport(zoneId, appId); var fileName = string.Format("2sxcApp_{0}_{1}.zip", appWrapper.GetNameWithoutSpecialChars(), appWrapper.GetVersion()); using (var fileStream = zipExport.ExportApp(includeContentGroups, resetAppGuid)) { var fileBytes = fileStream.ToArray(); return(HttpResponseMessageHelper.GetAttachmentHttpResponseMessage(fileName, "application/octet-stream", new MemoryStream(fileBytes))); } }
public HttpResponseMessage ExportContent(int appId, int zoneId, string contentTypeIdsString, string entityIdsString, string templateIdsString) { EnsureUserIsAdmin(); var appWrapper = new SxcAppWrapper(appId); var fileName = string.Format("2sxcContentExport_{0}_{1}.xml", appWrapper.GetNameWithoutSpecialChars(), appWrapper.GetVersion()); var fileXml = new XmlExporter ( zoneId, appId, false, contentTypeIdsString == null ? new string[0] : contentTypeIdsString.Split(';'), entityIdsString == null ? new string[0] : entityIdsString.Split(';') ).GenerateNiceXml(); return(HttpResponseMessageHelper.GetAttachmentHttpResponseMessage(fileName, "text/xml", fileXml)); }
public dynamic GetAppInfo(int appId, int zoneId) { var appWrapper = new SxcAppWrapper(appId); var zipExport = new ZipExport(zoneId, appId); return(new { Name = appWrapper.App.Name, Guid = appWrapper.App.AppGuid, Version = appWrapper.GetVersion(), EntitiesCount = appWrapper.GetEntities().Count(), LanguagesCount = appWrapper.GetActiveLanguages().Count(), TemplatesCount = appWrapper.GetTemplates().Count(), HasRazorTemplates = appWrapper.GetRazorTemplates().Count() > 0, HasTokenTemplates = appWrapper.GetTokenTemplates().Count() > 0, FilesCount = zipExport.FileManager.AllFiles.Count(), TransferableFilesCount = zipExport.FileManager.AllTransferableFiles.Count() }); }