Expose the Datatype Service GetById

This commit is contained in:
Kevin Giszewski
2014-02-20 11:07:20 -05:00
parent 7831e476e3
commit f05a67d9d2
3 changed files with 31 additions and 1 deletions
@@ -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" />
+1 -1
View File
@@ -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) {