Example #1
0
        public async Task<ActionResult> added()
        {
            var builds = Build.Select().OrderByDescending(b => b.Added).Take(20);

            RssDocument rdoc = new RssDocument()
            {
                Channel = new RssChannel()
                {
                    Title = "BuildFeed RSS - Recently Added",
                    Description = "",
                    Generator = "BuildFeed.net RSS Controller",
                    Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
                    SkipHours = new List<Hour>(),
                    SkipDays = new List<Day>(),

                    Items = (from build in builds
                             select new RssItem()
                             {
                                 Title = build.FullBuildString,
                                 Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"),
                                 Guid = new RssGuid() { IsPermaLink = true, Value = $"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"
                                                      },
                                 InternalPubDate = new RssDate(build.Added).DateStringISO8601 // bit of a dirty hack to work around problem in X.Web.RSS with the date format.
                             }).ToList()
                }
            };

            Response.ContentType = "application/rss+xml";

            await Response.Output.WriteAsync(rdoc.ToXml());

            return new EmptyResult();
        }
Example #2
0
        public async Task<ActionResult> index()
        {
            var builds = Build.SelectInBuildOrder().Take(20);

            RssDocument rdoc = new RssDocument()
            {
                Channel = new RssChannel()
                {
                    Title = "BuildFeed RSS - Recently Compiled",
                    Description = "",
                    Generator = "BuildFeed.net RSS Controller",
                    Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}"),
                    SkipHours = new List<Hour>(),
                    SkipDays = new List<Day>(),

                    Items = (from build in builds
                             select new RssItem()
                             {
                                 Title = build.FullBuildString,
                                 Link = new RssUrl($"{Request.Url.Scheme}://{Request.Url.Authority}{Url.Action("viewBuild", new { controller = "front", id = build.Id })}"),
                                 Guid = new RssGuid() { IsPermaLink = true, Value = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("viewBuild", new { controller = "front", id = build.Id })) },
                             }).ToList()
                }
            };

            Response.ContentType = "application/rss+xml";

            await Response.Output.WriteAsync(rdoc.ToXml());

            return new EmptyResult();
        }