コード例 #1
0
        public async Task <IActionResult> Index()
        {
            ViewUsersAndRolesViewModel model = new ViewUsersAndRolesViewModel
            {
                AllUsers = await accountManager.GetAll(),
                AllRoles = await accountManager.GetAllRoles()
            };

            //var users = await accountManager.GetAll();
            return(View(model));
        }
コード例 #2
0
        public async Task <IActionResult> CreateRole(CreateRoleViewModel role)
        {
            var res = await accountManager.CreateRole(role);

            if (res == null)
            {
                ViewUsersAndRolesViewModel model = new ViewUsersAndRolesViewModel
                {
                    AllUsers = await accountManager.GetAll(),
                    AllRoles = await accountManager.GetAllRoles()
                };
                return(View(nameof(Index), model));
            }
            foreach (var err in res)
            {
                ModelState.AddModelError("", err.Description.ToString());
            }
            return(View(role));
        }