Last active
October 14, 2015 10:04
-
-
Save carlwoodhouse/b7c69809e8a9fd0b2b14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var contentAzDefinitions = this.cacheManager.Get( | |
string.Concat("Patient.Contenttypes.Az.Ids.For.", letter), | |
ctx => { | |
ctx.Monitor(this.clock.When(Timespan.FromDays(1))); | |
var titleDefinitions = this.letterRepository.Fetch(x => x.Title.StartsWith(letter)).toList(); | |
var content = this.contentManager.GetMany(titleDefinitions.Select(x => x.ContentItemId), VersionOptions.Published); | |
var items = new List<AzLinkDefinition>(); | |
foreach(var titleDefinition in titleDefinitions) | |
{ | |
var contentItem = content.FirstOrDefault(x => x.Id == titleDefinition.ContentItemId); | |
items.Add(new AzLinkDefinition { Title = titleDefinition.Title, Path = contentItem.As<IAliasAspect>().Path, ContentType = contentItem.ContentType.Name }); | |
} | |
return items; | |
}); | |
var itemsByLetter = contentAzDefinitions.Where(x => x.ContentType == contentType); | |
// do something here | |
} | |
class AzLinkDefinition | |
{ | |
public string Title { get; set; } | |
public string Path { get; set; } | |
public string ContentType { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment