コード例 #1
0
 public IActionResult EditRole(int id)
 {
     var finder = new ManageRoles();
     var roleToEdit = finder.GetRoleById(id);
     
     if (roleToEdit == null)
     {
         ViewBag.ErrorMessage = $"Role with Id = {id} cannot be found";
         return View("Error");
     }
     ViewBag.UsersInRole = finder.GetUsersInRole(id);
     return View(roleToEdit);
 }
コード例 #2
0
        public IActionResult EditUserInRole(int id)
        {

            var finder = new ManageRoles();
            var role = finder.GetRoleById(id);
            if (role == null)
            {
                ViewBag.ErrorMessage = $"Role with Id = {id} cannot be found";
                return View("Error");
            }
            ViewBag.Role = role;

            var users = new UserManager().GetUsersByRole(role);

            return View(users);
        }