예제 #1
0
        public async Task <ActionResult> EditRole(string roleName)
        {
            MVC5_TemplateIdentityRole MVC5_TemplateIdentityRole = await _RoleManager.FindByNameAsync(roleName);

            EditRoleViewModel editRoleViewModel = new EditRoleViewModel()
            {
                RoleID   = MVC5_TemplateIdentityRole.Id,
                RoleName = MVC5_TemplateIdentityRole.Name
            };

            return(View(editRoleViewModel));
        }
예제 #2
0
        public async Task <ActionResult> CreateRole(CreateRoleViewModel createRoleViewModel)
        {
            MVC5_TemplateIdentityRole role = new MVC5_TemplateIdentityRole(createRoleViewModel.RoleName);

            var result = await _RoleManager.CreateAsync(role);

            if (result.Succeeded == false)
            {
                _UserSettingsLogic.AddErrors(ModelState, result);
                return(View());
            }

            return(View());
        }