public async Task <IdentityResourceDto> UpdateAsync(Guid id, UpdateIdentityResourceInputDto input) { var nameExist = await _repository.CheckNameExistAsync(input.Name, id); if (nameExist) { throw new IdentityResourceNameNotAllowedDuplicateException(input.Name); } var identityResource = await _repository.FindAsync(id); identityResource = ObjectMapper.Map <UpdateIdentityResourceInputDto, IdentityResource>(input, identityResource); // userClaim identityResource.RemoveAllUserClaims(); if (input.UserClaims != null) { input.UserClaims.ForEach(e => { identityResource.AddUserClaim(e); }); } identityResource = await _repository.UpdateAsync(identityResource); return(MapToGetOutputDto(identityResource)); }
public async Task <IdentityResourceDto> UpdateAsync(Guid id, UpdateIdentityResourceInputDto input) { var nameExist = await _repository.CheckNameExistAsync(input.Name, id); if (nameExist) { throw new IdentityResourceNameNotAllowedDuplicateException(input.Name); } var identityResource = await _repository.FindAsync(id); identityResource = ObjectMapper.Map <UpdateIdentityResourceInputDto, IdentityResource>(input, identityResource); identityResource = await _repository.UpdateAsync(identityResource); return(MapToGetOutputDto(identityResource)); }
public virtual async Task DeleteAsync(Guid id) { var client = await _resourceRepository.FindAsync(id); if (client == null) { throw new EntityNotFoundException(typeof(IdentityResource), id); } await _resourceRepository.DeleteAsync(id); }
public async Task <IEnumerable <IdentityResourceViewModel> > GetIdentityResourcesAsync() { var resources = await _identityResourceRepository.FindAsync(r => true); return(_mapper.Map <IEnumerable <IdentityResourceViewModel> >(resources)); }
public async Task <IdS4IdentityResource> FindAsync(int id) { return(await _identityResourceRepository.FindAsync(id)); }