示例#1
0
        public virtual async Task <ApiResourceDto> CreateAsync(ApiResourceCreateDto input)
        {
            var apiResourceExists = await ApiResourceRepository.CheckNameExistAsync(input.Name);

            if (apiResourceExists)
            {
                throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ApiResourceNameExisted, input.Name]);
            }
            var apiResource = new ApiResource(GuidGenerator.Create(), input.Name,
                                              input.DisplayName, input.Description)
            {
                Enabled = input.Enabled
            };

            await UpdateApiResourceByInputAsync(apiResource, input);

            apiResource = await ApiResourceRepository.InsertAsync(apiResource);

            await CurrentUnitOfWork.SaveChangesAsync();

            return(ObjectMapper.Map <ApiResource, ApiResourceDto>(apiResource));
        }
 public virtual async Task <ApiResourceDto> CreateAsync(ApiResourceCreateDto input)
 {
     return(await ApiResourceAppService.CreateAsync(input));
 }