public async Task <ActionResult <IdentityResource> > Save([FromBody] IdentityResource model) { if (!ModelState.IsValid) { return(BadRequest(new ValidationProblemDetails(ModelState))); } await _identityResourceRepository.InsertAsync(model, true); var idr = await _identityResourceRepository.GetAsync(model.Id, true); return(CreatedAtAction(nameof(Details), new { resource = model.Name }, idr)); }
protected virtual async Task AddIdentityResourceIfNotExistsAsync(IdentityServer4.Models.IdentityResource resource) { if (await IdentityResourceRepository.CheckNameExistAsync(resource.Name)) { return; } await IdentityResourceRepository.InsertAsync( new IdentityResource( GuidGenerator.Create(), resource ) ); }