public ActionResult Index(string categoryAlias = "", int pageNumber = 1) { if (pageNumber <= 0) { pageNumber = 1; } var channel = RssModel.GetRssChannel(this.HttpContext, categoryAlias, pageNumber); string rss = RssWriter.Write(channel); return(this.Content(rss, "text/xml", Encoding.UTF8)); }
public async Task <ActionResult> IndexAsync(string categoryAlias = "", int pageNumber = 1) { if (pageNumber <= 0) { pageNumber = 1; } var channel = await RssModel.GetRssChannelAsync(this.Tenant, FrapidHttpContext.GetCurrent(), categoryAlias, pageNumber).ConfigureAwait(false); string rss = RssWriter.Write(channel); return(this.Content(rss, "text/xml", Encoding.UTF8)); }
private void write(RssWriter writer) { try { if (channels.Count == 0) throw new InvalidOperationException("Feed must contain at least one channel."); writer.Version = rssVersion; writer.Modules = modules; foreach (DSD.Site.UtilityClasses.RSS.NET.RssChannel.RssChannel channel in channels) { if (channel.Items.Count == 0) throw new InvalidOperationException("Channel must contain at least one item."); writer.Write(channel); } } finally { if (writer != null) writer.Close(); } }