private async Task RemoveRange(IEnumerable <PersistedGrant> list) { foreach (var g in list) { await _commands.DeleteAsync(_siteId, g.Key).ConfigureAwait(false); } }
public async Task Delete( Guid siteId, Guid userId, CancellationToken cancellationToken = default(CancellationToken)) { var projectId = siteId.ToString(); await userCommands.DeleteAsync(projectId, userId.ToString(), cancellationToken).ConfigureAwait(false); // try catch here is because NoDb throws an error if the folder doesn't exist and it may not exist // for these if there are no social logins for any user, or claims, or tokens try { await DeleteUserRoles(siteId, userId); } catch { } try { await DeleteClaimsByUser(siteId, userId); } catch { } try { await DeleteLoginsByUser(siteId, userId); } catch { } try { await DeleteTokensByUser(siteId, userId); } catch { } }
public async Task Update( string projectId, IPost post, CancellationToken cancellationToken = default(CancellationToken) ) { var p = Post.FromIPost(post); p.LastModified = DateTime.UtcNow; //since we store posts in year month folders we need to check if pubdate changed and move the file if needed by delete and re-reate. var currentVersion = await _query.FetchAsync(projectId, p.Id); if (currentVersion.PubDate != p.PubDate) { await _commands.DeleteAsync(projectId, p.Id).ConfigureAwait(false); await _commands.CreateAsync(projectId, p.Id, p).ConfigureAwait(false); } else { await _commands.UpdateAsync(projectId, p.Id, p).ConfigureAwait(false); } _cache.ClearListCache(projectId); }
public async Task Delete( Guid siteId, Guid userId, CancellationToken cancellationToken = default(CancellationToken)) { await EnsureProjectId().ConfigureAwait(false); await userCommands.DeleteAsync(projectId, userId.ToString(), cancellationToken).ConfigureAwait(false); }
private async Task RemoveRange(string siteId, IEnumerable <PersistedGrant> list) { foreach (var g in list) { var gi = g as GrantItem; if (gi != null) { await _commands.DeleteAsync(siteId, gi.Id).ConfigureAwait(false); } } }
public async Task Delete( Guid siteId, Guid userId, CancellationToken cancellationToken = default(CancellationToken)) { var projectId = siteId.ToString(); await userCommands.DeleteAsync(projectId, userId.ToString(), cancellationToken).ConfigureAwait(false); await DeleteLoginsByUser(siteId, userId); await DeleteClaimsByUser(siteId, userId); await DeleteUserRoles(siteId, userId); await DeleteTokensByUser(siteId, userId); }
public async Task DeleteUserLocation( Guid userLocationId, CancellationToken cancellationToken = default(CancellationToken) ) { ThrowIfDisposed(); cancellationToken.ThrowIfCancellationRequested(); await EnsureProjectId().ConfigureAwait(false); await locationCommands.DeleteAsync( projectId, userLocationId.ToString(), cancellationToken).ConfigureAwait(false); }
public async Task RemoveUserFromRole( Guid siteId, Guid roleId, Guid userId, CancellationToken cancellationToken = default(CancellationToken)) { ThrowIfDisposed(); cancellationToken.ThrowIfCancellationRequested(); if (roleId == Guid.Empty) { throw new ArgumentException("roleId must be provided"); } if (userId == Guid.Empty) { throw new ArgumentException("userId must be provided"); } //await EnsureProjectId().ConfigureAwait(false); var projectId = siteId.ToString(); var key = userId.ToString() + "~" + roleId.ToString(); await userRoleCommands.DeleteAsync( projectId, key, cancellationToken).ConfigureAwait(false); }
public async Task RemoveByDeviceCodeAsync(string deviceCode) { var site = _contextAccessor.HttpContext.GetTenant <SiteContext>(); if (site == null) { _logger.LogError("sitecontext was null"); return; } var siteId = site.Id.ToString(); var all = await GetAllInternalAsync(siteId); var deviceFlowCodes = all.FirstOrDefault(x => x.DeviceCode == deviceCode && x.SiteId == siteId); if (deviceFlowCodes != null) { _logger.LogDebug("removing {deviceCode} device code from database", deviceCode); await _commands.DeleteAsync(siteId, deviceFlowCodes.UserCode); } else { _logger.LogDebug("no {deviceCode} device code found in database", deviceCode); } }
public async Task Delete( string projectId, string projectKey, CancellationToken cancellationToken = default(CancellationToken) ) { await commands.DeleteAsync(projectId, projectKey).ConfigureAwait(false); }
public async Task Delete( string projectId, string id, CancellationToken cancellationToken = default(CancellationToken) ) { await _kvpCommands.DeleteAsync(projectId, id, cancellationToken).ConfigureAwait(false); }
private async Task DeleteClientClaims(string siteId, string clientId, CancellationToken cancellationToken = default(CancellationToken)) { var claims = await GetClientClaims(siteId, clientId, cancellationToken).ConfigureAwait(false); foreach (var cc in claims) { await _claimCommands.DeleteAsync(siteId, cc.Id, cancellationToken).ConfigureAwait(false); } }
public async Task DeleteGeoZone( Guid stateId, CancellationToken cancellationToken = default(CancellationToken)) { ThrowIfDisposed(); cancellationToken.ThrowIfCancellationRequested(); if (stateId == Guid.Empty) { throw new ArgumentException("stateid must be a non-empty guid"); } await EnsureProjectId().ConfigureAwait(false); await stateCommands.DeleteAsync( projectId, stateId.ToString(), cancellationToken).ConfigureAwait(false); }
public async Task Delete( string tenantId, Guid id, CancellationToken cancellationToken = default(CancellationToken)) { await _policyCommands.DeleteAsync(tenantId, id.ToString(), cancellationToken).ConfigureAwait(false); _cache.ClearListCache(tenantId); }
public async Task DeleteQuestion(int questionId) { var result = _pageQueriesQuestion.FetchAsync("Cues", questionId.ToString()).Result; if (result != null) { await _pageCommandsQuestion.DeleteAsync("Cues", result.Id.ToString()); } }
public async Task DeleteCategory(int categoryId) { var parentExistsResult = _pageQueriesCategory.GetAllAsync("Cues").Result.Where(x => x.ParentCategoryId == categoryId).ToList(); if (!parentExistsResult.Any()) { await _pageCommandsCategory.DeleteAsync("Cues", categoryId.ToString()); } }
public async Task <IActionResult> Delete(string id) { if ((await cardQueries.FetchAsync("BlueShift", id)) != null) { await cardCommands.DeleteAsync("BlueShift", id); return(Ok()); } return(BadRequest(new { error = $"Card with id [{id}] does not exist. You can only delete existing cards." })); }
public async Task DeleteHost( Guid hostId, CancellationToken cancellationToken = default(CancellationToken)) { if (hostId == Guid.Empty) { throw new ArgumentException("hostId must not be empty guid"); } ThrowIfDisposed(); cancellationToken.ThrowIfCancellationRequested(); await EnsureProjectId().ConfigureAwait(false); await hostCommands.DeleteAsync( projectId, hostId.ToString(), cancellationToken).ConfigureAwait(false); }
public async Task DeleteClaim( Guid claimId, CancellationToken cancellationToken = default(CancellationToken)) { ThrowIfDisposed(); cancellationToken.ThrowIfCancellationRequested(); if (claimId == Guid.Empty) { throw new ArgumentException("id must be provided"); } await EnsureProjectId().ConfigureAwait(false); await claimCommands.DeleteAsync( projectId, claimId.ToString(), cancellationToken).ConfigureAwait(false); }
public async Task DeleteSubscription(string endpoint) { var all = await _queries.GetAllAsync(_NoDbProjectId).ConfigureAwait(false); var found = all.Where(x => x.Endpoint == endpoint).SingleOrDefault(); if (found != null) { await _commands.DeleteAsync(_NoDbProjectId, found.Key.ToString()).ConfigureAwait(false); } }
public async Task Delete( Guid logItemId, CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); ThrowIfDisposed(); await commands.DeleteAsync( options.ProjectId, logItemId.ToString(), cancellationToken).ConfigureAwait(false); }
public async Task DeleteRole( Guid siteId, Guid roleId, CancellationToken cancellationToken = default(CancellationToken)) { ThrowIfDisposed(); cancellationToken.ThrowIfCancellationRequested(); if (roleId == Guid.Empty) { throw new ArgumentException("Id must be provided"); } //await EnsureProjectId().ConfigureAwait(false); var projectId = siteId.ToString(); await roleCommands.DeleteAsync( projectId, roleId.ToString(), cancellationToken).ConfigureAwait(false); }
public async Task DeleteLogin( Guid siteId, Guid userId, string loginProvider, string providerKey, CancellationToken cancellationToken = default(CancellationToken)) { ThrowIfDisposed(); cancellationToken.ThrowIfCancellationRequested(); if (siteId == Guid.Empty) { throw new ArgumentException("siteId must be provided"); } if (userId == Guid.Empty) { throw new ArgumentException("userId must be provided"); } if (string.IsNullOrWhiteSpace(loginProvider)) { throw new ArgumentException("loginProvider not valid"); } if (string.IsNullOrWhiteSpace(providerKey)) { throw new ArgumentException("providerKey not valid"); } //await EnsureProjectId().ConfigureAwait(false); var projectId = siteId.ToString(); var key = userId.ToString() + "~" + siteId.ToString() + "~" + loginProvider + "~" + providerKey; await loginCommands.DeleteAsync( projectId, key, cancellationToken).ConfigureAwait(false); }
// private ILogger log; public async Task HandlePubDateAboutToChange( string projectId, IPost post, DateTime newPubDate, CancellationToken cancellationToken = default(CancellationToken)) { if ((post.PubDate.Month == newPubDate.Month) && (post.PubDate.Year == newPubDate.Year)) { // we store posts in /year/month folders, if that didn't change no need to do anything return; } // because with the filesystem storage we are storing posts in a year/month folder // if the year or month changes we need to delete the old file and save the updated post to the // new year/month folder var p = Post.FromIPost(post); await commands.DeleteAsync(projectId, p.Id).ConfigureAwait(false); p.PubDate = newPubDate; await commands.CreateAsync(projectId, p.Id, p).ConfigureAwait(false); }
public async Task DeleteToken( Guid siteId, Guid userId, string loginProvider, string name, CancellationToken cancellationToken = default(CancellationToken)) { ThrowIfDisposed(); cancellationToken.ThrowIfCancellationRequested(); var projectId = siteId.ToString(); var key = userId.ToString() + "~" + siteId.ToString() + "~" + loginProvider + "~" + name; await tokenCommands.DeleteAsync( projectId, key, cancellationToken).ConfigureAwait(false); }
public async Task Delete( string projectId, Guid id, CancellationToken cancellationToken = default(CancellationToken) ) { await _commands.DeleteAsync(projectId, id.ToString(), cancellationToken).ConfigureAwait(false); }
public async Task Delete( string projectId, string pageId, CancellationToken cancellationToken = default(CancellationToken) ) { var page = await _query.FetchAsync(projectId, pageId, CancellationToken.None); if (page != null) { var pages = await GetAllPages(projectId, CancellationToken.None).ConfigureAwait(false); await _commands.DeleteAsync(projectId, pageId).ConfigureAwait(false); pages.Remove(page); } }
public async Task <bool> DeleteMovie(Guid id) { var movies = await GetAllMovies(); var movie = movies.FirstOrDefault(m => m.Id == id); if (movie == null) { throw new System.Exception("Movie Not found"); } await _movieCommands.DeleteAsync(projectId, id.ToString()).ConfigureAwait(false); _cache.Remove(moviesCacheKey); return(true); }
public async Task DeleteCountry( Guid countryId, CancellationToken cancellationToken = default(CancellationToken)) { ThrowIfDisposed(); cancellationToken.ThrowIfCancellationRequested(); if (countryId == Guid.Empty) { throw new ArgumentException("countryid must be a non-empty id"); } //await EnsureProjectId().ConfigureAwait(false); var projectId = "default"; await countryCommands.DeleteAsync( projectId, countryId.ToString(), cancellationToken).ConfigureAwait(false); }
public async Task <IActionResult> DeleteMovie([FromRoute] Guid id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var movies = await GetAllMovies(); var movie = movies.FirstOrDefault(m => m.Id == id); if (movie == null) { return(NotFound()); } await _movieCommands.DeleteAsync(projectId, id.ToString()).ConfigureAwait(false); _cache.Remove(moviesCacheKey); return(Ok(movie)); }