/// <summary> /// Adds an item to channel. /// </summary> /// <param name="item">The item.</param> public void AddItemToChannel(ChannelItemModel item) { channelItems.Add(item); }
/// <summary> /// Gets the channel. /// </summary> /// <returns></returns> public override ChannelModel GetChannel() { if(this.channel == null) { return null; } var channel = new ChannelModel( this.channel.Element("title").Value, this.channel.Element("link").Value, this.channel.Element("language").Value, this.channel.Element("copyright").Value); foreach (var item in this.channel.Elements("item")) { ChannelItemModel channelItem = new ChannelItemModel( item.Element("title").Value, item.Element("description").Value, item.Element("guid").Value, item.Element("pubDate").Value, GetMediaEnclosure(item.Element("enclosure")) );; channel.AddItemToChannel(channelItem); } return channel; }
/// <summary> /// Gets the channel. /// </summary> /// <returns></returns> public virtual ChannelModel GetChannel() { if(this.channel == null) { return null; } var channel = new ChannelModel( this.channel.Element("title") == null ? String.Empty : this.channel.Element("title").Value, this.channel.Element("link") == null ? String.Empty : this.channel.Element("link").Value, this.channel.Element("language") == null ? String.Empty : this.channel.Element("language").Value, this.channel.Element("copyright") == null ? String.Empty : this.channel.Element("copyright").Value); foreach (var item in this.channel.Elements("item")) { ChannelItemModel channelItem = new ChannelItemModel( item.Element("title").Value, item.Element("description").Value, item.Element("guid").Value, item.Element("pubDate").Value, item.Element("link").Value);; channel.AddItemToChannel(channelItem); } return channel; }