public async Task <SyndicationFeedViewModel> GetFeatureStoriesModel() { var model = new SyndicationFeedViewModel(); model.AlternateUri = new Uri(Configuration["NewsHostUri"]); model.Title = "Featured Stories"; model.AlternateUri = null; List <string> postKeys = IndexModel.GetFeaturePostKeysToLoad(await Repository.GetMinistriesAsync()).ToList(); postKeys.AddRange(IndexModel.GetFeaturePostKeysToLoad(await Repository.GetSectorsAsync())); (await Repository.GetHomeAsync()).AddFeaturePostKeyToLoad(postKeys); model.Entries = await Repository.GetPostsAsync(postKeys.Take(ProviderHelpers.MaximumSyndicationItems)); return(model); }
public async Task LoadAsync(BaseViewModel model) { using (Profiler.StepStatic("Create Ministry Models")) { var ministryModels = await Repository.GetMinistriesAsync(); List <string> postKeys = IndexModel.GetTopPostKeysToLoad(ministryModels).ToList(); postKeys.AddRange(IndexModel.GetFeaturePostKeysToLoad(ministryModels)); IEnumerable <Post> posts = await Repository.GetPostsAsync(postKeys); foreach (var ministryModel in ministryModels) { ministryModel.SetTopPost(posts); ministryModel.SetFeaturePost(posts); model.Ministries.Add(ministryModel); } } model.ResourceLinks = await Repository.GetResourceLinksAsync(); var homeSettings = (await Repository.GetHomeAsync()).Index as Home; model.WebcastingLive = !string.IsNullOrEmpty(homeSettings.LiveWebcastM3uPlaylist); }