Пример #1
0
 public ActionResult EditUserData(ApplicationUser user, string role, string userId)
 {
     logManager.AddEventLog("ManageController => EditUserData ActionResult called(POST)", "ActionResult");
     user.Id = userId ?? throw new ArgumentNullException();
     if (ModelState.IsValid)
     {
         usersManager.EditUser(user, null);
         return(RedirectToAction("Index", new { Message = ManageMessageId.ProfileEdited }));
     }
     else
     {
         ViewBag.UserId = userId;
         return(View(user));
     }
 }
Пример #2
0
 public ActionResult EditUser(ApplicationUser user, string role, string userId)
 {
     logManager.AddEventLog("ManageUsersController(Admin area) => EditUser ActionResult called(POST)", "ActionResult");
     user.Id = userId ?? throw new ArgumentNullException();
     if (ModelState.IsValid)
     {
         usersManager.EditUser(user, role);
         return(RedirectToAction("DisplayUsers", new { statusMessage = "You succesfully edited " + user.FirstName + " " + user.LastName + "user!" }));
     }
     else
     {
         ViewBag.CurrentRole = "Current role - " + usersManager.GetUserRole(user.Id);
         ViewBag.Roles       = new List <string> {
             "Admin", "Lector", "Student"
         };
         return(View(user));
     }
 }