コード例 #1
0
        public void AddOrUpdatePageContents(List <PageContent> contents)
        {
            try
            {
                if (contents != null)
                {
                    _pageContentRepository.AddOrUpdate(contents);

                    foreach (var pageContent in contents)
                    {
                        var adminPermissions = AddAdminPermissions(pageContent);

                        if (pageContent.ContentPermissions == null)
                        {
                            pageContent.ContentPermissions = adminPermissions;
                        }
                        else
                        {
                            adminPermissions.AddRange(pageContent.ContentPermissions);
                            pageContent.ContentPermissions = adminPermissions;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(string.Format("Error occured while updating page content"), ex);
            }
        }
コード例 #2
0
        public void AddOrUpdatePageContents(List <PageContent> contents)
        {
            if (contents == null)
            {
                throw new InvalidOperationException($"PageContents cannot be null");
            }

            _pageContentRepository.AddOrUpdate(contents);
        }