moderator backend work

This commit is contained in:
Michael 2017-05-17 17:16:16 -04:00
parent 700f7f1616
commit 513edd1335

View file

@ -127,7 +127,7 @@ public ActionResult ChangeUserName(string id, string newName)
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 @@ public ActionResult Lock(string id)
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 @@ public ActionResult Mute(string id, string returnUrl = "")
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 });
}
}
}