Skip to content

Commit 521be46

Browse files
authored
Merge pull request #6502 from erikjanwestendorp/update-image-cropper
Porting old Umbraco API Controller [Image Cropper]
2 parents e24abd0 + 68341a1 commit 521be46

File tree

2 files changed

+8
-14
lines changed
  • 14/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors
  • 15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors

2 files changed

+8
-14
lines changed

14/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/image-cropper.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,22 +116,19 @@ To update a content property value you need the [Content Service](https://apidoc
116116

117117
The following sample demonstrates how to add or change the value of an Image Cropper property programmatically. The sample creates an API controller with an action, which must be invoked via a POST request to the URL written above the action.
118118

119-
{% hint style="warning" %}
120-
The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15.
121-
{% endhint %}
122-
123119
```csharp
124120
using Microsoft.AspNetCore.Mvc;
125121
using Umbraco.Cms.Core.Models;
126122
using Umbraco.Cms.Core.PropertyEditors;
127123
using Umbraco.Cms.Core.PropertyEditors.ValueConverters;
128124
using Umbraco.Cms.Core.Serialization;
129125
using Umbraco.Cms.Core.Services;
130-
using Umbraco.Cms.Web.Common.Controllers;
131126

132127
namespace Umbraco.Docs.Samples.Web.Property_Editors_Add_Values;
133128

134-
public class CreateImageCropperValuesController : UmbracoApiController
129+
[ApiController]
130+
[Route("/umbraco/api/createimagecroppervalues")]
131+
public class CreateImageCropperValuesController : Controller
135132
{
136133
private readonly IContentService _contentService;
137134
private readonly IMediaService _mediaService;
@@ -150,7 +147,7 @@ public class CreateImageCropperValuesController : UmbracoApiController
150147
}
151148

152149
// /Umbraco/Api/CreateImageCropperValues/CreateImageCropperValues
153-
[HttpPost]
150+
[HttpPost("createimagecroppervalues")]
154151
public ActionResult<bool> CreateImageCropperValues()
155152
{
156153
// Create a variable for the GUID of the page you want to update

15/umbraco-cms/fundamentals/backoffice/property-editors/built-in-umbraco-property-editors/image-cropper.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,22 +116,19 @@ To update a content property value you need the [Content Service](https://apidoc
116116

117117
The following sample demonstrates how to add or change the value of an Image Cropper property programmatically. The sample creates an API controller with an action, which must be invoked via a POST request to the URL written above the action.
118118

119-
{% hint style="warning" %}
120-
The example below uses UmbracoApiController which is obsolete in Umbraco 14 and will be removed in Umbraco 15.
121-
{% endhint %}
122-
123119
```csharp
124120
using Microsoft.AspNetCore.Mvc;
125121
using Umbraco.Cms.Core.Models;
126122
using Umbraco.Cms.Core.PropertyEditors;
127123
using Umbraco.Cms.Core.PropertyEditors.ValueConverters;
128124
using Umbraco.Cms.Core.Serialization;
129125
using Umbraco.Cms.Core.Services;
130-
using Umbraco.Cms.Web.Common.Controllers;
131126

132127
namespace Umbraco.Docs.Samples.Web.Property_Editors_Add_Values;
133128

134-
public class CreateImageCropperValuesController : UmbracoApiController
129+
[ApiController]
130+
[Route("/umbraco/api/createimagecroppervalues")]
131+
public class CreateImageCropperValuesController : Controller
135132
{
136133
private readonly IContentService _contentService;
137134
private readonly IMediaService _mediaService;
@@ -150,7 +147,7 @@ public class CreateImageCropperValuesController : UmbracoApiController
150147
}
151148

152149
// /Umbraco/Api/CreateImageCropperValues/CreateImageCropperValues
153-
[HttpPost]
150+
[HttpPost("createimagecroppervalues")]
154151
public ActionResult<bool> CreateImageCropperValues()
155152
{
156153
// Create a variable for the GUID of the page you want to update

0 commit comments

Comments
 (0)