diff --git a/App_Start/RouteConfig.cs b/App_Start/RouteConfig.cs index e527446..405fae6 100644 --- a/App_Start/RouteConfig.cs +++ b/App_Start/RouteConfig.cs @@ -76,10 +76,16 @@ public static void RegisterRoutes(RouteCollection routes) defaults: new { controller = "Build", action = "Source", page = 1 } ); + routes.MapRoute( + name: "RSS (with ID)", + url: "rss/{action}/{id}/", + defaults: new { controller = "rss", action = "index" } + ); + routes.MapRoute( name: "RSS", url: "rss/{action}", - defaults: new { controller = "rss", action = "Index" } + defaults: new { controller = "rss", action = "index" } ); routes.MapRoute( diff --git a/BuildFeed.csproj b/BuildFeed.csproj index 3fd393e..7ffcdb1 100644 --- a/BuildFeed.csproj +++ b/BuildFeed.csproj @@ -44,8 +44,9 @@ False ..\packages\Antlr.3.5.0.2\lib\Antlr3.Runtime.dll - - ..\packages\elmah.corelibrary.1.2.1\lib\Elmah.dll + + False + ..\packages\elmah.corelibrary.1.2.2\lib\Elmah.dll ..\packages\Elmah.MVC.2.1.1\lib\net40\Elmah.Mvc.dll @@ -55,11 +56,13 @@ False ..\packages\Newtonsoft.Json.6.0.5\lib\net45\Newtonsoft.Json.dll - - ..\packages\NServiceKit.Common.1.0.11\lib\net35\NServiceKit.Common.dll + + False + ..\packages\NServiceKit.Common.1.0.27\lib\net35\NServiceKit.Common.dll - - ..\packages\NServiceKit.Common.1.0.11\lib\net35\NServiceKit.Interfaces.dll + + False + ..\packages\NServiceKit.Common.1.0.27\lib\net35\NServiceKit.Interfaces.dll ..\packages\NServiceKit.Redis.1.0.7\lib\net35\NServiceKit.Redis.dll @@ -152,7 +155,6 @@ - @@ -211,6 +213,7 @@ + diff --git a/Controllers/buildController.cs b/Controllers/buildController.cs index c03cef2..4e5c2ba 100644 --- a/Controllers/buildController.cs +++ b/Controllers/buildController.cs @@ -75,6 +75,12 @@ public ActionResult Source(TypeOfSource source, int page = 1) public ActionResult Info(int id) { Build b = Build.SelectById(id); + + if(b == null) + { + return new HttpNotFoundResult(); + } + return View(b); } diff --git a/Controllers/pageController.cs b/Controllers/pageController.cs deleted file mode 100644 index 7b401cc..0000000 --- a/Controllers/pageController.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; - -namespace BuildFeed.Controllers -{ - public class pageController : Controller - { - public ActionResult Index() - { - return new RedirectResult("/", true); - } - } -} \ No newline at end of file diff --git a/Controllers/rssController.cs b/Controllers/rssController.cs index 0722510..f0b5a8a 100644 --- a/Controllers/rssController.cs +++ b/Controllers/rssController.cs @@ -17,7 +17,7 @@ public class rssController : Controller { // // GET: /rss/ - public async Task Index() + public async Task index() { var builds = Build.SelectInBuildOrder().Take(20); @@ -49,7 +49,7 @@ public async Task Index() return new EmptyResult(); } - public async Task Added() + public async Task added() { var builds = Build.Select().OrderByDescending(b => b.Added).Take(20); @@ -83,7 +83,7 @@ public async Task Added() } - public async Task Version() + public async Task version() { var builds = Build.Select() .OrderByDescending(b => b.MajorVersion) @@ -121,5 +121,41 @@ public async Task Version() return new EmptyResult(); } + + + public async Task flight(LevelOfFlight id) + { + var builds = Build.SelectInBuildOrder() + .Where(b => b.FlightLevel == id) + .Take(20); + + + RssDocument rdoc = new RssDocument() + { + Channel = new RssChannel() + { + Title = string.Format("BuildFeed RSS - {0} Flight Level", id), + Description = "", + Generator = "BuildFeed.net RSS Controller", + Link = new RssUrl(string.Format("{0}://{1}", Request.Url.Scheme, Request.Url.Authority)), + SkipHours = new List(), + SkipDays = new List(), + + Items = (from build in builds + select new RssItem() + { + Title = build.FullBuildString, + Link = new RssUrl(string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("Info", new { controller = "Build", id = build.Id }))), + Guid = new RssGuid() { IsPermaLink = true, Value = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, Url.Action("Info", new { controller = "Build", id = build.Id })) }, + }).ToList() + } + }; + + Response.ContentType = "application/rss+xml"; + + await Response.Output.WriteAsync(rdoc.ToXml()); + + return new EmptyResult(); + } } } \ No newline at end of file diff --git a/Controllers/supportController.cs b/Controllers/supportController.cs index b271df1..7714308 100644 --- a/Controllers/supportController.cs +++ b/Controllers/supportController.cs @@ -111,5 +111,10 @@ public ActionResult thanks_register() { return View(); } + + public ActionResult rss() + { + return View(); + } } } \ No newline at end of file diff --git a/Models/Build.cs b/Models/Build.cs index f3249e1..7e0dea4 100644 --- a/Models/Build.cs +++ b/Models/Build.cs @@ -265,7 +265,7 @@ public enum LevelOfFlight { None = 0, Low = 1, - Medium = 2, + //Medium = 2, - medium only ever appears to return the same as high atm, may change in future. High = 3 } diff --git a/Views/shared/_default.cshtml b/Views/shared/_default.cshtml index 080ba2e..5d46d28 100644 --- a/Views/shared/_default.cshtml +++ b/Views/shared/_default.cshtml @@ -37,10 +37,8 @@
+ +

diff --git a/Views/support/rss.cshtml b/Views/support/rss.cshtml new file mode 100644 index 0000000..e4c9c6e --- /dev/null +++ b/Views/support/rss.cshtml @@ -0,0 +1,18 @@ +@{ + ViewBag.Title = "RSS Feeds"; +} + +

RSS Feeds

+ + \ No newline at end of file diff --git a/packages.config b/packages.config index 858e650..2ae0a7b 100644 --- a/packages.config +++ b/packages.config @@ -1,7 +1,7 @@  - + @@ -16,7 +16,7 @@ - +