diff --git a/Project-Unite/Controllers/ModeratorController.cs b/Project-Unite/Controllers/ModeratorController.cs index fcc3b2d..e880f13 100644 --- a/Project-Unite/Controllers/ModeratorController.cs +++ b/Project-Unite/Controllers/ModeratorController.cs @@ -14,9 +14,9 @@ namespace Project_Unite.Controllers public class ModeratorController : Controller { // GET: Moderator - public ActionResult Index() + public ActionResult Index(string id = "home") { - ViewBag.Moderator = true; + ViewBag.Page = id; return View(); } @@ -31,7 +31,7 @@ public ActionResult UserDetails(string id) public ActionResult Users() { - return View(new ApplicationDbContext().Users); + return Index("users"); } public ActionResult Unban(string id, string returnUrl = "") @@ -211,20 +211,12 @@ public ActionResult Unlist(string id) public ActionResult Bans() { - var model = new ModeratorBanListViewModel(); - var db = new ApplicationDbContext(); - - model.UserBans = db.Users.Where(x => x.IsBanned == true); - model.IPBans = db.BannedIPs; - - return View(model); + return Index("bans"); } public ActionResult Logs() { - var db = new ApplicationDbContext(); - - return View(db.AuditLogs.Where(x => x.Level != AuditLogLevel.Admin)); + return Index("logs"); } public ActionResult Mute(string id, string returnUrl = "") diff --git a/Project-Unite/Views/Moderator/Index.cshtml b/Project-Unite/Views/Moderator/Index.cshtml index d4b6569..25f9cee 100644 --- a/Project-Unite/Views/Moderator/Index.cshtml +++ b/Project-Unite/Views/Moderator/Index.cshtml @@ -1,7 +1,46 @@ - +@using Project_Unite.Models @{ ViewBag.Title = "Moderator CP"; + string homeclass = (ViewBag.Page == "home") ? "active" : ""; + string usersclass = (ViewBag.Page == "users") ? "active" : ""; + string bansclass = (ViewBag.Page == "bans") ? "active" : ""; + string logsclass = (ViewBag.Page == "logs") ? "active" : ""; + var db = new ApplicationDbContext(); + var users = db.Users; + var bans = new ModeratorBanListViewModel(); + bans.IPBans = db.BannedIPs; + bans.UserBans = db.Users.Where(x => x.IsBanned == true); + var logs = db.AuditLogs.Where(x => x.Level != AuditLogLevel.Admin); } +

Moderator Control Panel

+

Perform your moderative tasks here. Just, don't go rogue!

+
+
+

Places

+ +
+
+
+

Not yet implemented.

+ +

Please suggest things to be put here.

+
+
+ @Html.Partial("~/Views/Moderator/Users.cshtml", users); +
+
+ @Html.Partial("~/Views/Moderator/Bans.cshtml", bans) +
+
+ @Html.Partial("~/Views/Moderator/Logs.cshtml", logs) +
+
+
\ No newline at end of file