From cfda3c1fa9903683f83e3a759bf52bfd784d1933 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Mon, 21 Oct 2024 12:56:55 +0200 Subject: [PATCH 1/3] Change UmbracoApiController to Controller --- 14/umbraco-cms/reference/querying/umbraco-context.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/14/umbraco-cms/reference/querying/umbraco-context.md b/14/umbraco-cms/reference/querying/umbraco-context.md index ff820383122..e82015e42d1 100644 --- a/14/umbraco-cms/reference/querying/umbraco-context.md +++ b/14/umbraco-cms/reference/querying/umbraco-context.md @@ -29,13 +29,14 @@ using System.Diagnostics; using System.Linq; using Microsoft.AspNetCore.Mvc; using Umbraco.Cms.Core.Web; -using Umbraco.Cms.Web.Common.Controllers; using Umbraco.Cms.Web.Common.PublishedModels; using Umbraco.Extensions; namespace Umbraco.Docs.Samples.Web.Controllers.Api; -public class PeopleController : UmbracoApiController +[ApiController] +[Route("/umbraco/api/people")] +public class PeopleController : Controller { private readonly IUmbracoContextAccessor _umbracoContextAccessor; @@ -44,7 +45,7 @@ public class PeopleController : UmbracoApiController _umbracoContextAccessor = umbracoContextAccessor; } - [HttpGet] + [HttpGet("getall")] public ActionResult> GetAll() { if (_umbracoContextAccessor.TryGetUmbracoContext(out IUmbracoContext? context) == false) From c8f935133856565cf9b34eb4fb8e58d5e3910d26 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Mon, 21 Oct 2024 12:57:25 +0200 Subject: [PATCH 2/3] Delete obsolete message --- 14/umbraco-cms/reference/querying/umbraco-context.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/14/umbraco-cms/reference/querying/umbraco-context.md b/14/umbraco-cms/reference/querying/umbraco-context.md index e82015e42d1..739344f4dab 100644 --- a/14/umbraco-cms/reference/querying/umbraco-context.md +++ b/14/umbraco-cms/reference/querying/umbraco-context.md @@ -18,10 +18,6 @@ If you need an `UmbracoContext` in your own controllers, you need to inject an ` The following is an example of how to get access to the `UmbracoContext` in a controller: -{% hint style="warning" %} -The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15. -{% endhint %} - ``` csharp using System; using System.Collections.Generic; From f8ac2528238f3acef52ae1ab3d5a6adaf1ac955b Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Mon, 21 Oct 2024 13:01:49 +0200 Subject: [PATCH 3/3] Update v15 --- 15/umbraco-cms/reference/querying/umbraco-context.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/15/umbraco-cms/reference/querying/umbraco-context.md b/15/umbraco-cms/reference/querying/umbraco-context.md index ff820383122..739344f4dab 100644 --- a/15/umbraco-cms/reference/querying/umbraco-context.md +++ b/15/umbraco-cms/reference/querying/umbraco-context.md @@ -18,10 +18,6 @@ If you need an `UmbracoContext` in your own controllers, you need to inject an ` The following is an example of how to get access to the `UmbracoContext` in a controller: -{% hint style="warning" %} -The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15. -{% endhint %} - ``` csharp using System; using System.Collections.Generic; @@ -29,13 +25,14 @@ using System.Diagnostics; using System.Linq; using Microsoft.AspNetCore.Mvc; using Umbraco.Cms.Core.Web; -using Umbraco.Cms.Web.Common.Controllers; using Umbraco.Cms.Web.Common.PublishedModels; using Umbraco.Extensions; namespace Umbraco.Docs.Samples.Web.Controllers.Api; -public class PeopleController : UmbracoApiController +[ApiController] +[Route("/umbraco/api/people")] +public class PeopleController : Controller { private readonly IUmbracoContextAccessor _umbracoContextAccessor; @@ -44,7 +41,7 @@ public class PeopleController : UmbracoApiController _umbracoContextAccessor = umbracoContextAccessor; } - [HttpGet] + [HttpGet("getall")] public ActionResult> GetAll() { if (_umbracoContextAccessor.TryGetUmbracoContext(out IUmbracoContext? context) == false)