From e5ec0ad9c232b2613367de9461bca63bc2973787 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 6 Apr 2017 17:39:37 -0400 Subject: [PATCH] Modify dev CP You can now change obsolescence and stability of releases. --- .../Controllers/DeveloperController.cs | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Project-Unite/Controllers/DeveloperController.cs b/Project-Unite/Controllers/DeveloperController.cs index aed4eb5..9e2921b 100644 --- a/Project-Unite/Controllers/DeveloperController.cs +++ b/Project-Unite/Controllers/DeveloperController.cs @@ -21,6 +21,44 @@ namespace Project_Unite.Controllers return View(); } + public ActionResult ToggleObsolete(string id) + { + if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP")) + return new HttpStatusCodeResult(403); + + var db = new ApplicationDbContext(); + var release = db.Downloads.FirstOrDefault(x => x.Id == id); + release.Obsolete = !release.Obsolete; + db.SaveChanges(); + return RedirectToAction("Releases"); + } + + public ActionResult MakeUnstable(string id) + { + if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP")) + return new HttpStatusCodeResult(403); + + var db = new ApplicationDbContext(); + var release = db.Downloads.FirstOrDefault(x => x.Id == id); + release.IsStable = false; + db.SaveChanges(); + return RedirectToAction("Releases"); + } + + + public ActionResult MakeStable(string id) + { + if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP")) + return new HttpStatusCodeResult(403); + + var db = new ApplicationDbContext(); + var release = db.Downloads.FirstOrDefault(x => x.Id == id); + release.IsStable = true; + db.SaveChanges(); + return RedirectToAction("Releases"); + } + + public ActionResult Releases() { if (!ACL.Granted(User.Identity.Name, "CanAccessDevCP"))