Last active
October 14, 2015 09:45
-
-
Save carlwoodhouse/c8ad856585772134eedc 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 contentItemIdsByLetter = this.cacheManager.Get( | |
string.Concat("Patient.Contenttypes.Az.Ids.For.", letter), | |
ctx => { | |
ctx.Monitor(this.clock.When(Timespan.FromDays(1))); | |
return this.letterRepository.Fetch(x => x.Title.StartsWith(letter)).toList(); | |
} | |
var items = this.cacheManager.Get( | |
string.Concat("Patient.Contenttypes.Az.Items.For.", letter, ".By.", contentType), | |
ctx => { | |
ctx.Monitor(this.clock.When(Timespan.FromDays(1))); | |
var content = this.contentManager.GetMany(contentItemIdsByLetter.Select(x => x.ContentItemId), VersionOptions.Published) | |
.Where(x => x.ContentType.Name == contentType);// im not sure if you can pass contentypes to getmany? | |
var altTitles = new List<KeyValuePair>(); | |
foreach (var contentItem in content) | |
{ | |
var titles = contentItemIdsByLetter.Where(x => x.ContentItemId == contentItem.Id); | |
foreach (var title in titles) | |
{ | |
altTitles.Add(new KeyValuePair(title, contentItem.As<IAliasAspect>().Path)); | |
} | |
} | |
return altTitles; | |
} | |
// do something with items, like display them :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment