/// <summary> /// Subscribe the latest post in this website /// </summary> /// <returns>Xml rss 2.0 formatted Posts</returns> public ActionResult RssFeed() { bool ispremium; if ((CodeFirstSecurity.IsAuthenticated) && (CodeFirstRoleServices.IsUserInRole(CodeFirstSecurity.CurrentUserName, BgResources.Security_PremiumRole))) { ispremium = true; } else { ispremium = false; } var postItems = BlogServices.FindRSSPosts(ispremium, 20) .Select(p => new SyndicationItem(p.Title, p.Description, new Uri(Url.AbsoluteAction("GetPostByCode", "Post", new { id = p.Code }))) { PublishDate = new DateTimeOffset(p.DateCreated), Copyright = new TextSyndicationContent(BgResources.Messages_Copyright), }); var feed = new SyndicationFeed(String.Format(Resources.AppMessages.Rss_Latest_Post_Title, BgResources.Messages_SiteTitle), Resources.AppMessages.Rss_Latest_Post_Description, new Uri(Url.AbsoluteAction("NewPosts", "Post")), postItems); return(new FeedResult(new Rss20FeedFormatter(feed))); }