예제 #1
0
        public static bool DeleteQueryIfNotUsedByView(this CmsManager cms, int id, ILog log)
        {
            var wrapLog = log.Call <bool>($"delete pipe:{id} on app:{cms.AppId}");

            // Stop if views still use this Query
            var templatesUsingPipeline = cms.Read.Views.GetAll()
                                         .Where(t => t.Query?.Id == id)
                                         .Select(t => t.Id)
                                         .ToArray();

            if (templatesUsingPipeline.Any())
            {
                throw new Exception(
                          $"Query is used by Views and cant be deleted. Query ID: {id}. TemplateIds: {string.Join(", ", templatesUsingPipeline)}");
            }

            return(wrapLog("ok", cms.Queries.Delete(id)));
        }
예제 #2
0
 public CmsManagerBase(CmsManager cmsManager, ILog parentLog, string logRename)
     : base(cmsManager, parentLog, logRename)
     => CmsManager = cmsManager;
예제 #3
0
 public BlocksManager(CmsManager cms, ILog parentLog)
     : base(cms, parentLog, "CG.Manage")
 {
 }
예제 #4
0
 public ViewsManager(CmsManager cmsManager, ILog parentLog) : base(cmsManager, parentLog, "Cms.ViewMn")
 {
 }