From 12f2b2c17a520c0f928d3b55bbe0ef73d5485b10 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Tue, 8 Oct 2024 10:26:52 +0200 Subject: [PATCH 1/3] Update Controller --- 14/umbraco-cms/reference/using-ioc.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/14/umbraco-cms/reference/using-ioc.md b/14/umbraco-cms/reference/using-ioc.md index 4bb48fa31ad..3500254f05a 100644 --- a/14/umbraco-cms/reference/using-ioc.md +++ b/14/umbraco-cms/reference/using-ioc.md @@ -231,11 +231,13 @@ The example below uses UmbracoApiController which is obsolete in Umbraco 14 and ```csharp using IOCDocs.Services; -using Umbraco.Cms.Web.Common.Controllers; +using Microsoft.AspNetCore.Mvc; namespace IOCDocs.Controllers; -public class FooController : UmbracoApiController +[ApiController] +[Route("/umbraco/api/foo")] +public class FooController : Controller { private readonly IFooBar _fooBar; @@ -244,6 +246,7 @@ public class FooController : UmbracoApiController _fooBar = fooBar; } + [HttpGet("foo")] public string Foo() { var bar = _fooBar.Foo(); From 7e5d340a2b1d72bcb2e488975cb2f40a1294ffc8 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Tue, 8 Oct 2024 10:29:42 +0200 Subject: [PATCH 2/3] Update v15 --- 15/umbraco-cms/reference/using-ioc.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/15/umbraco-cms/reference/using-ioc.md b/15/umbraco-cms/reference/using-ioc.md index 4bb48fa31ad..3500254f05a 100644 --- a/15/umbraco-cms/reference/using-ioc.md +++ b/15/umbraco-cms/reference/using-ioc.md @@ -231,11 +231,13 @@ The example below uses UmbracoApiController which is obsolete in Umbraco 14 and ```csharp using IOCDocs.Services; -using Umbraco.Cms.Web.Common.Controllers; +using Microsoft.AspNetCore.Mvc; namespace IOCDocs.Controllers; -public class FooController : UmbracoApiController +[ApiController] +[Route("/umbraco/api/foo")] +public class FooController : Controller { private readonly IFooBar _fooBar; @@ -244,6 +246,7 @@ public class FooController : UmbracoApiController _fooBar = fooBar; } + [HttpGet("foo")] public string Foo() { var bar = _fooBar.Foo(); From d25dbec729ccab7a0e4321dd7a99fc049358d9a9 Mon Sep 17 00:00:00 2001 From: Erik-Jan Westendorp Date: Tue, 8 Oct 2024 10:31:10 +0200 Subject: [PATCH 3/3] Delete obsolete message --- 14/umbraco-cms/reference/using-ioc.md | 4 ---- 15/umbraco-cms/reference/using-ioc.md | 4 ---- 2 files changed, 8 deletions(-) diff --git a/14/umbraco-cms/reference/using-ioc.md b/14/umbraco-cms/reference/using-ioc.md index 3500254f05a..dc7309f89b3 100644 --- a/14/umbraco-cms/reference/using-ioc.md +++ b/14/umbraco-cms/reference/using-ioc.md @@ -223,10 +223,6 @@ Once you have registered the dependencies inject them into your project where ne If you need to inject your service into a controller or another service, you will do so through the class. -{% hint style="warning" %} -The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15. -{% endhint %} - {% code title="FooController.cs" %} ```csharp diff --git a/15/umbraco-cms/reference/using-ioc.md b/15/umbraco-cms/reference/using-ioc.md index 3500254f05a..dc7309f89b3 100644 --- a/15/umbraco-cms/reference/using-ioc.md +++ b/15/umbraco-cms/reference/using-ioc.md @@ -223,10 +223,6 @@ Once you have registered the dependencies inject them into your project where ne If you need to inject your service into a controller or another service, you will do so through the class. -{% hint style="warning" %} -The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15. -{% endhint %} - {% code title="FooController.cs" %} ```csharp