This is a simple code, which I have used to create my own RSS feed.
Creating the Feed
<code>public class RSSFeed
{
public static List CreateFeed()
{
var items = new List();
var blogs = Models.Blog.Queries.BlogQuery.RenderActiveList();
foreach(var blog in blogs)
{
var item = new SyndicationItem()
{
Id = Guid.NewGuid().ToString(),
Title = new TextSyndicationContent(blog.Title),
Content = = new TextSyndicationContent(blog.Body, TextSyndicationContentKind.Html),
PublishDate = (DateTime)blog.PublishDate,
LastUpdatedTime = (DateTime)blog.UpdateDate,
};
item.Links.Add(SyndicationLink.CreateAlternateLink(new Uri(String.Format("http://coopsblog.wales/blog/viewblog/{0}",blog.Name))));
item.Categories.Add(new SyndicationCategory("CodeProject"));
string[] tags = blog.Tags.Split(',');
foreach (string tag in tags)
item.Categories.Add(new SyndicationCategory(tag));
items.Add(item);
}
return items;
}
public static List CreateFeedCP()
{
var items = new List();
var blogs = Models.Blog.Queries.BlogQuery.RenderActiveList();
return blogs;
}
}</code>
MVC View
This simply references the above code and returns it as an Action Result.
[HttpGet]
public ActionResult RssFeed()
{
return new RssFeed("application/rss+xml", "Coopsblog", String.Format("A RSS feed to my blogs"),PrimaryCore.RSSFeed.CreateFeed());
}
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.