public async Task <ActionResult> ConfigureUserToRole(int userId, string role) { if (ModelState.IsValid) { try { bool result = _identityManager.AssignRoleToUser(userId, role, await _identityManager.GetLoggedInUserIdAsync()); if (result == false) { throw new ArgumentNullException("Cannot assign role to the user"); } } catch (Exception ex) { throw ex; } } return(RedirectToAction(nameof(SearchUserRoles))); }