diff options
| author | Michael <[email protected]> | 2017-05-17 17:16:16 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-05-17 17:16:16 -0400 |
| commit | 513edd13359350aee171875e8141f7fbb5b1cca6 (patch) | |
| tree | 8b41287f4453fe84653dfcb9921e837e557934cf /Project-Unite | |
| parent | 700f7f1616c8144d7b23b746f98e525df7424b14 (diff) | |
| download | project-unite-513edd13359350aee171875e8141f7fbb5b1cca6.tar.gz project-unite-513edd13359350aee171875e8141f7fbb5b1cca6.tar.bz2 project-unite-513edd13359350aee171875e8141f7fbb5b1cca6.zip | |
moderator backend work
Diffstat (limited to 'Project-Unite')
| -rw-r--r-- | Project-Unite/Controllers/ModeratorController.cs | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/Project-Unite/Controllers/ModeratorController.cs b/Project-Unite/Controllers/ModeratorController.cs index 70404e4..fcc3b2d 100644 --- a/Project-Unite/Controllers/ModeratorController.cs +++ b/Project-Unite/Controllers/ModeratorController.cs @@ -127,7 +127,7 @@ namespace Project_Unite.Controllers return new HttpStatusCodeResult(200); } - public ActionResult Lock(string id) + public ActionResult LockTopic(string id) { var db = new ApplicationDbContext(); var forum = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id); @@ -147,7 +147,7 @@ namespace Project_Unite.Controllers return RedirectToAction("ViewTopic", "Forum", new { id = id }); } - public ActionResult Unlock(string id) + public ActionResult UnlockTopic(string id) { var db = new ApplicationDbContext(); var forum = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id); @@ -251,5 +251,38 @@ namespace Project_Unite.Controllers return Redirect(returnUrl); } + public ActionResult AnnounceTopic(string id) + { + var db = new ApplicationDbContext(); + var topic = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id); + if (topic == null) + return new HttpStatusCodeResult(404); + topic.IsAnnounce = !topic.IsAnnounce; + db.SaveChanges(); + return RedirectToAction("ViewTopic", "Forum", new { id = id }); + } + + public ActionResult GlobalTopic(string id) + { + var db = new ApplicationDbContext(); + var topic = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id); + if (topic == null) + return new HttpStatusCodeResult(404); + topic.IsGlobal = !topic.IsGlobal; + db.SaveChanges(); + return RedirectToAction("ViewTopic", "Forum", new { id = id }); + } + + public ActionResult StickyTopic(string id) + { + var db = new ApplicationDbContext(); + var topic = db.ForumTopics.FirstOrDefault(x => x.Discriminator == id); + if (topic == null) + return new HttpStatusCodeResult(404); + topic.IsSticky = !topic.IsSticky; + db.SaveChanges(); + return RedirectToAction("ViewTopic", "Forum", new { id = id }); + } + } }
\ No newline at end of file |
