示例#1
0
        public IActionResult Index(string link = @"https://www.espn.com/espn/rss/news")
        {
            RSSChannelModel rssChanel = _httpWorker.GetRSSChanel(link);

            ViewData["Link"] = link;
            return(View(rssChanel));
        }
示例#2
0
        private RSSChannelModel SerializeXML(string xml)
        {
            XmlSerializer   serializer = new XmlSerializer(typeof(RSSChannelModel));
            RSSChannelModel rssChannel = new RSSChannelModel();

            try
            {
                rssChannel = (RSSChannelModel)serializer.Deserialize(new StringReader(xml));
            }
            catch
            {
                rssChannel.NewsArray       = new NewsModel[0];
                rssChannel.httpWorkerError = HTTPWorkerError.InvalidRSSXML;
            }
            return(rssChannel);
        }