コード例 #1
0
        public IHttpActionResult Get(int seriesId)
        {
            var series = new ContentChannelItemService(_rockContext).Get(seriesId);

            if (series != null && series.ContentChannelId == 10)
            {
                series.LoadAttributes();
                var seriesImageFile = _binaryFileService.Get(series.GetAttributeValue("PodcastImage").AsGuid());

                return(Ok(series.ChildItems
                          .Select(i => i.ChildContentChannelItem)
                          .Where(i => i.ContentChannelId == 11 && i.StartDateTime < DateTime.Now)
                          .OrderBy(i => i.StartDateTime)
                          .Select(item =>
                {
                    var archiveItem = GetArchiveObjectForMessage(item);

                    if (seriesImageFile != null)
                    {
                        archiveItem.AudioImage = seriesImageFile.Path;
                    }

                    return archiveItem;
                })
                          ));
            }
            else
            {
                return(NotFound());
            }
        }