mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 03:11:48 -05:00
moderator backend work
This commit is contained in:
parent
700f7f1616
commit
513edd1335
1 changed files with 35 additions and 2 deletions
|
@ -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 });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue