예제 #1
0
 private async Task DeleteAsync(Scope scope)
 {
     if (scope != null)
     {
         _scopeRepository.Delete(scope);
         await _scopeRepository.SaveAsync();
     }
 }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }