public async Task <ActionResult> EditUserInfo_UserSelected(ActionWithUserSearchData data, string submitAction) { if (!this.HttpContext.Session.HasSystemActionRights() || !this.HttpContext.Session.HasSystemActionRight(ActionRights.UserManagement)) { return(RedirectToAction("Index", "Home")); } if (submitAction == "SearchAgain") { return(await EditUserInfo()); } if (submitAction != "PerformAction") { return(RedirectToAction("Index", "Home")); } if (data.FindUserData.SelectedUserIDs == null || data.FindUserData.SelectedUserIDs.Count <= 0) { return(await EditUserInfo_Find(data)); } var user = await UserGuiHelper.GetUserAsync(data.FindUserData.SelectedUserIDs.FirstOrDefault()); if (user == null) { // not found return(RedirectToAction("Index", "Home")); } var newData = new EditUserInfoData() { UserId = user.UserID, EmailAddress = user.EmailAddress, NickName = user.NickName, DateOfBirth = user.DateOfBirth, Occupation = user.Occupation ?? string.Empty, Location = user.Location ?? string.Empty, Signature = user.Signature ?? string.Empty, Website = user.Website ?? string.Empty, IconURL = user.IconURL ?? string.Empty, UserTitleId = user.UserTitleID, IPAddress = user.IPNumber, LastVisitDate = user.LastVisitedDate.HasValue ? user.LastVisitedDate.Value.ToString("f") : "Never", IsBanned = user.IsBanned, RoleIDs = await SecurityGuiHelper.GetAllRoleIDsForUserAsync(user.UserID), Roles = await SecurityGuiHelper.GetAllRolesAsync(), UserTitles = await UserGuiHelper.GetAllUserTitlesAsync(), }; newData.Sanitize(); return(View("~/Views/Admin/EditUserInfo.cshtml", newData)); }