Adds GetIdForUdi to UmbracoHelper
This commit is contained in:
@@ -17,7 +17,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Umbraco.Core.Cache;
|
||||
|
||||
namespace Umbraco.Web
|
||||
@@ -38,6 +37,7 @@ namespace Umbraco.Web
|
||||
private MembershipHelper _membershipHelper;
|
||||
private TagQuery _tag;
|
||||
private IDataTypeService _dataTypeService;
|
||||
private IEntityService _entityService;
|
||||
private UrlProvider _urlProvider;
|
||||
private ICultureDictionary _cultureDictionary;
|
||||
|
||||
@@ -113,6 +113,14 @@ namespace Umbraco.Web
|
||||
get { return _dataTypeService ?? (_dataTypeService = UmbracoContext.Application.Services.DataTypeService); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lazy instantiates the IEntityService
|
||||
/// </summary>
|
||||
public IEntityService EntityService
|
||||
{
|
||||
get { return _entityService ?? (_entityService = UmbracoContext.Application.Services.EntityService); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Lazy instantiates the IUmbracoComponentRenderer if not specified in the constructor
|
||||
/// </summary>
|
||||
@@ -1489,5 +1497,10 @@ namespace Umbraco.Web
|
||||
return surfaceRouteParams.EncryptWithMachineKey();
|
||||
}
|
||||
|
||||
public int GetIdForUdi(Udi udi)
|
||||
{
|
||||
var udiToIdAttempt = EntityService.GetIdForUdi(udi);
|
||||
return udiToIdAttempt.Success ? udiToIdAttempt.Result : -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user