public async Task <ActionResult> UpdateIdentityResource([FromBody] UpdateIdentityResourceDto identityResource) { var currentIdentityResource = await this._configurationManagementService.ReturnIdentityResourceAsync(identityResource.OriginalName); if (currentIdentityResource == null) { return(NotFound()); } await this._configurationManagementService.UpdateIdentityResourcesAsync(identityResource); return(NoContent()); }
public async Task UpdateIdentityResourcesAsync(UpdateIdentityResourceDto resource) { DateTime now = DateTime.Now; var currentIdentityResource = await this._configContext.IdentityResources.FirstOrDefaultAsync(a => a.Name == resource.OriginalName); currentIdentityResource.Name = resource.Name; currentIdentityResource.Required = resource.Required; currentIdentityResource.ShowInDiscoveryDocument = resource.ShowInDiscoveryDocument; currentIdentityResource.Updated = now; currentIdentityResource.Description = resource.Description; currentIdentityResource.DisplayName = resource.DisplayName; currentIdentityResource.Emphasize = resource.Emphasize; currentIdentityResource.Enabled = resource.Enabled; this._configContext.IdentityResources.Update(currentIdentityResource); await this._configContext.SaveChangesAsync(); }