From dbce55459fae3568c3cd69562b5fe37bc7493d1c Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 11 May 2017 10:14:48 -0400 Subject: Jesus. *looks at the atmosphere with major thoights of the mess he has created* --- Project-Unite/Controllers/ModeratorController.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'Project-Unite/Controllers/ModeratorController.cs') diff --git a/Project-Unite/Controllers/ModeratorController.cs b/Project-Unite/Controllers/ModeratorController.cs index 99ef8b7..04e40de 100644 --- a/Project-Unite/Controllers/ModeratorController.cs +++ b/Project-Unite/Controllers/ModeratorController.cs @@ -104,24 +104,18 @@ namespace Project_Unite.Controllers return Redirect(returnUrl); } - [HttpPost] - [ValidateAntiForgeryToken] - public ActionResult ChangeUserName(string id, ApplicationUser model, string returnUrl = "") + public ActionResult ChangeUserName(string id, string newName) { var db = new ApplicationDbContext(); var usr = db.Users.FirstOrDefault(x => x.Id == id); if (usr == null) return new HttpStatusCodeResult(404); - usr.DisplayName = model.DisplayName; + usr.DisplayName = newName; db.SaveChanges(); - if (string.IsNullOrWhiteSpace(returnUrl)) - return RedirectToAction("Users"); - else - return Redirect(returnUrl); - + return new HttpStatusCodeResult(200); } public ActionResult Lock(string id) -- cgit v1.2.3