예제 #1
0
        public async Task ExecuteAsync(RoleDetailsDto roleDetailsDto)
        {
            var role = _mapper.Map <ApplicationRole>(roleDetailsDto);

            NormalizeRoleCode(role);
            try
            {
                var resultOfRoleCreated = await _roleManager.CreateAsync(role);

                if (resultOfRoleCreated.Succeeded == false)
                {
                    throw new ValidationException(string.Join(", ", resultOfRoleCreated.Errors.Select(x => x.Description)));
                }

                await _roleClaimsUpdater.UpdateAsync(role, roleDetailsDto.Permissions);

                await _roleRouteStagesUpdater.UpdateAsync(role.Id, roleDetailsDto.RoleStages);
            }
            catch (Exception e)
            {
                throw new DatabaseException(e.InnerException?.Message ?? e.Message);
            }
        }
예제 #2
0
파일: Update.cs 프로젝트: Hugoberry/WEB
 private async Task SaveRoleRouteStagesAsync(int roleId, int[] roleRouteStages)
 {
     await _roleRouteStagesUpdater.UpdateAsync(roleId, roleRouteStages);
 }