public virtual async Task <int> DeleteApiResourceScopeAsync(ApiResourceScope apiResourceScope) { var resourceScopeToDelete = await DbContext.ApiResourceScopes.SingleOrDefaultAsync(x => x.Id == apiResourceScope.Id); DbContext.ApiResourceScopes.Remove(resourceScopeToDelete); return(await AutoSaveChangesAsync()); }
public virtual async Task <bool> CanInsertApiResourceScopeAsync(ApiResourceScope apiResourceScope) { var existsWithSameName = await DbContext.ApiResourceScopes .SingleOrDefaultAsync(x => x.Scope.Equals(apiResourceScope.Scope) && x.ApiResource.Id == apiResourceScope.ApiResourceId); return(existsWithSameName == null); }
public virtual ApiResourceScope AddScope([NotNull] string scope) { var apiResourceScope = new ApiResourceScope(Id, scope); Scopes.Add(apiResourceScope); return(apiResourceScope); }
public static ScopeModel FromEntity(ApiResourceScope apiScope) { return(new ScopeModel { Id = apiScope.Id, Scope = apiScope.Scope, ApiResourceId = apiScope.ApiResourceId, ApiResourceName = apiScope.ApiResource.Name, ApiResource = apiScope.ApiResource, }); }
public virtual async Task <int> AddApiResourceScopeAsync(int apiResourceId, ApiScope apiScope) { DbContext.ApiScopes.Add(apiScope); var apiResourceScope = new ApiResourceScope() { Id = apiScope.Id, Scope = apiScope.Name, ApiResourceId = apiResourceId }; DbContext.ApiResourceScopes.Add(apiResourceScope); await AutoSaveChangesAsync(); return(apiScope.Id); }
public void UpdateEntity(ApiResourceScope entity) { entity.Scope = Scope; }
// TODO: This is not a good mapping public static ApiResourceScopeModel ToModel(this ApiResourceScope scope) { return(Mapper.Map <ApiResourceScopeModel>(scope)); }
public async Task <bool> DeleteApiResourceScopeAsync(ApiResourceScope apiResourceScope) { return(await _repository.DeleteAsync(apiResourceScope)); }
public async Task <int> InsertApiResourceScopeAsync(ApiResourceScope apiResourceScope) { return(await _repository.InsertAsync(apiResourceScope)); }
public static ApiResourceScopeDto ToModel(this ApiResourceScope resource) { return(resource == null ? null : Mapper.Map <ApiResourceScopeDto>(resource)); }