Expose the Datatype Service GetById
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using AutoMapper;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Models.Mapping;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.Editors;
|
||||
|
||||
namespace Archetype.Umbraco.Api
|
||||
{
|
||||
[PluginController("ArchetypeApi")]
|
||||
public class ArchetypeDataTypeController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
//pulled from the Core
|
||||
public DataTypeDisplay GetById(int id)
|
||||
{
|
||||
var dataType = Services.DataTypeService.GetDataTypeDefinitionById(id);
|
||||
if (dataType == null)
|
||||
{
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
return Mapper.Map<IDataTypeDefinition, DataTypeDisplay>(dataType);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -184,6 +184,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Api\ArchetypeDataTypeController.cs" />
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Extensions\Extensions.cs" />
|
||||
<Compile Include="Models\Archetype.cs" />
|
||||
|
||||
@@ -12,7 +12,7 @@ angular.module('umbraco.resources').factory('archetypePropertyEditorResource', f
|
||||
},
|
||||
getDataType: function(id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get("/umbraco/backoffice/UmbracoApi/DataType/GetById?id=" + id), 'Failed to retrieve datatype'
|
||||
$http.get("/umbraco/backoffice/ArchetypeApi/ArchetypeDataType/GetById?id=" + id), 'Failed to retrieve datatype'
|
||||
);
|
||||
},
|
||||
getPropertyEditorMapping: function(alias) {
|
||||
|
||||
Reference in New Issue
Block a user