Skip to content

Commit

Permalink
角色顯示使用者清單
Browse files Browse the repository at this point in the history
  • Loading branch information
malagege committed Aug 19, 2022
1 parent 6f56c8b commit d913d9d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion AuthSample/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public async Task<IActionResult> EditRoleAsync(string id)
}

[HttpPost]
public async Task<IActionResult> EditRole(EditRoleViewModel model)
public async Task<IActionResult> EditRoleAsync(EditRoleViewModel model)
{
IdentityRole role = await _roleManager.FindByIdAsync(model.Id);

Expand Down
22 changes: 22 additions & 0 deletions AuthSample/Views/Admin/EditRole.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,26 @@
<button>更新</button>
<a asp-action="rolelist">取消</a>
</div>
<div>
<h3>該角色中的使用者</h3>
<hr />
<div>
@if (Model.Users.Any())
{
<ul>
@foreach (string user in Model.Users)
{
<li>@user</li>
}
</ul>
}
else
{
<h5>目前沒有使用者綁定</h5>
}
</div>
<div>
<!-- 添加使用者到角色裡面-->
</div>
</div>
</form>

0 comments on commit d913d9d

Please sign in to comment.