From 34e036a8412ab2419b825fb79a4f3a77d3b5ef81 Mon Sep 17 00:00:00 2001 From: Esha Noronha Date: Wed, 16 Jul 2025 12:52:38 +0200 Subject: [PATCH] Replaced deprecated methods --- .../reference/management/using-services/contentservice.md | 7 ++++--- .../reference/management/using-services/contentservice.md | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/15/umbraco-cms/reference/management/using-services/contentservice.md b/15/umbraco-cms/reference/management/using-services/contentservice.md index 986c38de8b5..91817b0cb93 100644 --- a/15/umbraco-cms/reference/management/using-services/contentservice.md +++ b/15/umbraco-cms/reference/management/using-services/contentservice.md @@ -28,7 +28,7 @@ public class PublishContentDemo var parentId = Guid.Parse("b6fbbb31-a77f-4f9c-85f7-2dc4835c7f31"); // Create a new child item of type 'Product' - var demoProduct = ContentService.Create("Microphone", parentId, "product"); + var demoProduct = _contentService.Create("Microphone", parentId, "product"); // Set the value of the property with alias 'category' demoProduct.SetValue("category" , "audio"); @@ -37,7 +37,8 @@ public class PublishContentDemo demoProduct.SetValue("price", "1500"); // Save and publish the child item - _contentService.SaveAndPublish(demoProduct); + _contentService.Save(demoProduct); + _contentService.Publish(demoProduct, ["en-us", "da"]); } } ``` @@ -74,7 +75,7 @@ public class PublishContentDemo IContent? content = _contentService.GetById(key) ?? throw new InvalidOperationException($"Could not find content with key: {key}."); - _contentService.SaveAndPublishBranch(content, PublishBranchFilter.Default); + _contentService.PublishBranch(content, PublishBranchFilter.Default, ["en-us", "da"]); } } ``` diff --git a/16/umbraco-cms/reference/management/using-services/contentservice.md b/16/umbraco-cms/reference/management/using-services/contentservice.md index 986c38de8b5..eb6248a6cd3 100644 --- a/16/umbraco-cms/reference/management/using-services/contentservice.md +++ b/16/umbraco-cms/reference/management/using-services/contentservice.md @@ -28,7 +28,7 @@ public class PublishContentDemo var parentId = Guid.Parse("b6fbbb31-a77f-4f9c-85f7-2dc4835c7f31"); // Create a new child item of type 'Product' - var demoProduct = ContentService.Create("Microphone", parentId, "product"); + var demoProduct = _contentService.Create("Microphone", parentId, "product"); // Set the value of the property with alias 'category' demoProduct.SetValue("category" , "audio"); @@ -37,7 +37,8 @@ public class PublishContentDemo demoProduct.SetValue("price", "1500"); // Save and publish the child item - _contentService.SaveAndPublish(demoProduct); + _contentService.Save(demoProduct); + _contentService.Publish(demoProduct, ["en-us", "da"]); } } ``` @@ -74,7 +75,7 @@ public class PublishContentDemo IContent? content = _contentService.GetById(key) ?? throw new InvalidOperationException($"Could not find content with key: {key}."); - _contentService.SaveAndPublishBranch(content, PublishBranchFilter.Default); + _contentService.PublishBranch(content, PublishBranchFilter.Default, ["en-us", "da"]); } } ```