示例#1
0
        /// <summary>
        /// Reads the RSS.
        /// </summary>
        /// <param name="htmlHelper">The HTML helper.</param>
        /// <param name="feedLink">The feed link.</param>
        /// <returns></returns>
        public static MvcHtmlString ReadRss(this HtmlHelper htmlHelper, string feedLink)
        {
            try
            {
                List <RssFeedModel> feedItems = new List <RssFeedModel>();
                FeedFor             feedfor   = FeedFor.Facebook;
                switch (feedLink)
                {
                case "Facebook:RssFeed":
                    feedfor = FeedFor.Facebook;
                    break;

                case "Twitter:RssFeed":
                    feedfor = FeedFor.Twitter;
                    break;

                case "Pinterest:RssFeed":
                    feedfor = FeedFor.Pinterest;
                    break;
                }

                NJFairground.Web.Utilities.SocialMedia.IFeedReader feedReader
                    = NJFairground.Web.Utilities.SocialMedia.SocialFeedReader.GetSocialMediaFeed(feedfor);

                feedItems = feedReader.Read().ToList();
                return(new MvcHtmlString(GetHtmlFromRss(feedItems)));
            }
            catch (Exception ex)
            {
                ex.ExceptionValueTracker(feedLink);
            }
            return(new MvcHtmlString(string.Empty));
        }
示例#2
0
        /// <summary>
        /// Reads the instagram RSS.
        /// </summary>
        /// <param name="htmlHelper">The HTML helper.</param>
        /// <param name="feedLink">The feed link.</param>
        /// <returns></returns>
        public static MvcHtmlString ReadInstagramRss(this HtmlHelper htmlHelper, string feedLink)
        {
            NJFairground.Web.Utilities.SocialMedia.IFeedReader feedReader
                = NJFairground.Web.Utilities.SocialMedia.SocialFeedReader.GetSocialMediaFeed(FeedFor.Instagram);

            List <RssFeedModel> feedItems = feedReader.Read().ToList();

            return(new MvcHtmlString(GetHtmlFromRss(feedItems)));
        }