Exemple #1
0
        private async Task DeleteModule(Module module)
        {
            try
            {
                await PageModuleService.DeletePageModuleAsync(module.PageModuleId);

                // check if there are any remaining module instances in the site
                _modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId);

                if (!_modules.Exists(item => item.ModuleId == module.ModuleId))
                {
                    await ModuleService.DeleteModuleAsync(module.ModuleId);
                }

                await logger.LogInformation("Module Permanently Deleted {Module}", module);
                await Load();

                StateHasChanged();
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Permanently Deleting Module {Module} {Error}", module, ex.Message);

                AddModuleMessage("Error Permanently Deleting Module", MessageType.Error);
            }
        }