Ejemplo n.º 1
0
 public IActionResult EditUser(EditUserViewModel model)
 {
     if (ModelState.IsValid)
     {
         if (HttpContext.Session.GetString("AdminValidity") == "Admin" || HttpContext.Session.GetString("AdminValidity") == "Super Admin")
         {
             User userWhoEdited = _context.GetUser(Convert.ToInt32(HttpContext.Session.GetString("LoginID")));
             _context.EditUser(model);
             EditUserViewModel newDetails = model;
             _context.LogAction("User Edited", "Name: " + newDetails.FirstName + " " + newDetails.LastName + " Email: " + newDetails.UserEmail + " Role: " + newDetails.UserRole, userWhoEdited);
             TempData["Status"] = "User successfully edited.";
         }
     }
     return(RedirectToAction("ViewUsers"));
 }