private static string GetUniqueIdentifier(ContentItem item) { string slug = null; if (item.Has<AutoroutePart>()) { var route = item.Get<AutoroutePart>(); slug = route.Path; } return string.Format("{0} {1}", item.Id, slug); }
private static RouteValueDictionary GetRouteValues(IContentItemDriver driver, ContentItem contentItem) { //TODO: (erikpo) Need to rearrange ContentItemDriver so reflection isn't needed here var driverType = driver.GetType(); var method = driverType.GetMethod("GetDisplayRouteValues"); if (method != null) { return (RouteValueDictionary)method.Invoke(driver, new object[] {contentItem.Get(driverType.BaseType.GetGenericArguments()[0])}); } return null; }
public string GetUniqueIdentifier(ContentItem item) { string slug = null; if (item.Has<RoutePart>()) { var route = item.Get<RoutePart>(); slug = route.Slug; } return string.Format("{0} {1}", item.Id, slug); }
/// <summary> /// Gets a content part by its type. /// </summary> /// <returns>The content part or <code>null</code> if it doesn't exist.</returns> public static TPart As <TPart>(this ContentItem contentItem) where TPart : ContentPart { return(contentItem.Get <TPart>(typeof(TPart).Name)); }
private void SetupTagCloudLoader(ContentItem item) { var cloudPart = (TagCloudPart) item.Get(typeof (TagCloudPart)); cloudPart._tagCounts.Loader(tags => _tagCloudService.GetPopularTags(cloudPart.Buckets, cloudPart.Slug).ToList()); }
private void SetupTagCloudLoader(ContentItem item) { var cloudPart = (LocalizedTagCloudPart)item.Get(typeof(LocalizedTagCloudPart)); cloudPart._tags.Loader(() => _tagsService.GetLocalizedTags().ToList()); }