public async Task <IActionResult> Index(DynamicRoleClaimsManagerViewModel model)
        {
            var result = await _roleManager.AddOrUpdateRoleClaimsAsync(
                roleId : model.RoleId,
                roleClaimType : ConstantPolicies.DynamicPermissionClaimType,
                selectedRoleClaimValues : model.ActionIds);

            if (!result.Succeeded)
            {
                return(BadRequest(error: result.DumpErrors(useHtmlNewLine: true)));
            }
            return(Json(new { success = true }));
        }
Example #2
0
        public async Task <ActionResult> AddOrUpdate(DynamicRoleClaimsManagerViewModel model)
        {
            var result = await _roleManager.AddOrUpdateRoleClaimsAsync(
                model.RoleId,
                ConstantPolicies.DynamicPermissionClaimType,
                model.ActionIds);

            if (!result.Succeeded)
            {
                return(BadRequest(result.DumpErrors(true)));
            }

            return(Ok());
        }