public async Task <IActionResult> AddApiScope(CreateApiScopeDto apiScope) { if (!ModelState.IsValid) { return(BadRequest(ModelStateErrors)); } var result = await _apiresourceService.AddScope(apiScope); return(ResultResponse(result, "添加ApiScope成功")); }
public async Task <bool> AddScope(CreateApiScopeDto apiScope) { var apiresource = await _apiresourceRepository.GetByIdAsync(apiScope.ApiResourceId); if (apiresource == null) { throw new Exception("apiResource不存在"); } var entity = _mapper.Map <ApiScope>(apiScope); await _apiscopeRepository.AddAsync(entity); return(await _apiscopeRepository.SaveChangesAsync() > 0); }