public async Task <bool> RemoveBookmarkAsync(Guid userId, Guid articleId) { var query = _bookmarksRepository.Where(d => d.ArticleId == articleId && d.UserId == userId); var match = await _asyncQueryExecutor.FirstOrDefaultAsync(query); if (match == null) { return(false); } await _bookmarksRepository.DeleteAsync(match); await _uowManager.Current.SaveChangesAsync(); return(true); }
public virtual async Task <Client> FindClientByIdAsync(string clientId) { var client = await _asyncQueryableExecuter.FirstOrDefaultAsync(_repository.GetAll() .Include(x => x.AllowedGrantTypes) .Include(x => x.RedirectUris) .Include(x => x.PostLogoutRedirectUris) .Include(x => x.AllowedScopes) .Include(x => x.ClientSecrets) .Include(x => x.Claims) .Include(x => x.IdentityProviderRestrictions) .Include(x => x.AllowedCorsOrigins) .Include(x => x.Properties) .Where(x => x.ClientId == clientId)); Logger.DebugFormat("{0} found in database: {1}", clientId, client != null); return(ObjectMapper.Map <Client>(client)); }
public virtual async Task <ApiResource> FindApiResourceAsync(string name) { var api = await _asyncQueryableExecuter.FirstOrDefaultAsync(_apiResourceRepository.GetAll() .Include(x => x.Secrets) .Include(x => x.Scopes) .ThenInclude(s => s.UserClaims) .Include(x => x.UserClaims) .Where(x => x.Name == name)); if (api != null) { Logger.DebugFormat("Found {0} API resource in database", name); } else { Logger.DebugFormat("Did not find {0} API resource in database", name); } return(ObjectMapper.Map <ApiResource>(api)); }