File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -223,19 +223,17 @@ Once you have registered the dependencies inject them into your project where ne
223223
224224If you need to inject your service into a controller or another service, you will do so through the class.
225225
226- {% hint style="warning" %}
227- The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15.
228- {% endhint %}
229-
230226{% code title="FooController.cs" %}
231227
232228``` csharp
233229using IOCDocs .Services ;
234- using Umbraco . Cms . Web . Common . Controllers ;
230+ using Microsoft . AspNetCore . Mvc ;
235231
236232namespace IOCDocs .Controllers ;
237233
238- public class FooController : UmbracoApiController
234+ [ApiController ]
235+ [Route (" /umbraco/api/foo" )]
236+ public class FooController : Controller
239237{
240238 private readonly IFooBar _fooBar ;
241239
@@ -244,6 +242,7 @@ public class FooController : UmbracoApiController
244242 _fooBar = fooBar ;
245243 }
246244
245+ [HttpGet (" foo" )]
247246 public string Foo ()
248247 {
249248 var bar = _fooBar .Foo ();
Original file line number Diff line number Diff line change @@ -223,19 +223,17 @@ Once you have registered the dependencies inject them into your project where ne
223223
224224If you need to inject your service into a controller or another service, you will do so through the class.
225225
226- {% hint style="warning" %}
227- The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15.
228- {% endhint %}
229-
230226{% code title="FooController.cs" %}
231227
232228``` csharp
233229using IOCDocs .Services ;
234- using Umbraco . Cms . Web . Common . Controllers ;
230+ using Microsoft . AspNetCore . Mvc ;
235231
236232namespace IOCDocs .Controllers ;
237233
238- public class FooController : UmbracoApiController
234+ [ApiController ]
235+ [Route (" /umbraco/api/foo" )]
236+ public class FooController : Controller
239237{
240238 private readonly IFooBar _fooBar ;
241239
@@ -244,6 +242,7 @@ public class FooController : UmbracoApiController
244242 _fooBar = fooBar ;
245243 }
246244
245+ [HttpGet (" foo" )]
247246 public string Foo ()
248247 {
249248 var bar = _fooBar .Foo ();
You can’t perform that action at this time.
0 commit comments