Example #1
0
        public async Task <ActionResult> Feature(string type, string format)
        {
            if (!string.Equals(type, "feed", StringComparison.OrdinalIgnoreCase))
            {
                throw new NotImplementedException();
            }

            var featureKeys = IndexModel.GetFeaturePostKeys(await GetAllCategories());

            var model = await GetSyndicationFeedViewModel("Featured Stories", featureKeys);

            return(await GetNewsFeedContent(format, model, false, false));
        }
Example #2
0
        public async Task <ActionResult> CategoryFeature(string key, string type, string format)
        {
            if (!string.Equals(type, "feed", StringComparison.OrdinalIgnoreCase))
            {
                throw new NotImplementedException();
            }

            var categories = await GetAllCategories();

            var category = categories.Where(c => c.Key == key).ToList();
            var topKeys  = IndexModel.GetFeaturePostKeys(category);

            var model = await GetSyndicationFeedViewModel("Top Stories", topKeys);

            return(await GetNewsFeedContent(format, model, false, false));
        }
Example #3
0
        public async Task LoadAsync(BaseViewModel model, List <IndexModel> additionalIndexModels = null)
        {
            using (Profiler.StepStatic("Create Ministry Models"))
            {
                var ministries = await Repository.GetMinistriesAsync();

                List <string> uncachedPostKeys = IndexModel.GetTopPostKeys(ministries).ToList();
                uncachedPostKeys.AddRange(IndexModel.GetFeaturePostKeys(ministries));
                if (additionalIndexModels != null)
                {
                    var additionalIndexes = additionalIndexModels.Select(m => m.Index);
                    uncachedPostKeys.AddRange(IndexModel.GetTopPostKeys(additionalIndexes));
                    uncachedPostKeys.AddRange(IndexModel.GetFeaturePostKeys(additionalIndexes));
                }
                IEnumerable <Post> loadedPosts = await Repository.GetPostsAsync(uncachedPostKeys);

                foreach (var ministry in ministries)
                {
                    var ministryModel = new IndexModel(ministry);
                    ministryModel.SetTopPost(loadedPosts);
                    ministryModel.SetFeaturePost(loadedPosts);
                    model.Ministries.Add(ministryModel);
                }
                if (additionalIndexModels != null)
                {
                    foreach (var indexModel in additionalIndexModels)
                    {
                        indexModel.SetTopPost(loadedPosts);
                        indexModel.SetFeaturePost(loadedPosts);
                    }
                }
            }

            model.ResourceLinks = await Repository.GetResourceLinksAsync();

            var homeSettings = await Repository.GetHomeAsync();

            model.WebcastingLive = !string.IsNullOrEmpty(homeSettings?.LiveWebcastM3uPlaylist);
            model.GranvilleLive  = !string.IsNullOrEmpty(homeSettings?.Granville);
        }