public static bool ContentIsSameType(this IContent content, ContentTypeKey key) { if (content == null) { return(false); } return(content.ContentType.Alias.Equals(key.ToString(), StringComparison.InvariantCultureIgnoreCase)); }
public static Func <IEnumerable <IContent> > MyGetIContentsByTypeFromService(ContentTypeKey key, IContentService service, IContentTypeService typeService) { var type = typeService.GetContentType(key.ToString()); return(() => { return service.GetContentOfContentType(type.Id); }); }
public static Func <IDictionary <int, CacheIContent>, IEnumerable <CacheIContent> > MyGetContentByTypeFromCache(ContentTypeKey key) { return((cacheInput) => { var cache = new Dictionary <int, CacheIContent>(cacheInput); return cache .Where(b => b.Value.Content.ContentType.Alias.Equals(key.ToString(), StringComparison.InvariantCultureIgnoreCase)) .Select(b => b.Value); }); }
public override string ToString() => contentTypeKey.ToString() + ": " + name;
public static string ContentTypeViewPath(this ContentTypeKey type) { return($"~/Views/{type.ToString()}.cshtml"); }