private async Task DeleteAsync(Scope scope) { if (scope != null) { _scopeRepository.Delete(scope); await _scopeRepository.SaveAsync(); } }
private async Task <Scope> UpdateAsync(Scope scope, Scope updatedScope) { if (updatedScope.ApplicationId != scope.ApplicationId) { throw new BadRequestException("Cannot change application of a scope."); } scope.Update(updatedScope); await _scopeRepository.SaveAsync(); return(scope); }
private async Task <Scope> AddAsync(Scope scope, Application application) { if (application.Scopes.Any(s => s.Name == scope.Name)) { throw new ConflictException("Scope name already exists."); } _scopeRepository.Add(scope); await _scopeRepository.SaveAsync(); return(scope); }