/// <summary> /// Removes the kind actions (developer purpose, not for regular use). /// </summary> /// <param name="userId">The user identifier.</param> /// <returns></returns> public async Task RemoveKindActions(string userId) { var filter = TableQuery.GenerateFilterCondition( "UserId", QueryComparisons.Equal, userId); var kindActions = await _azureManager.GetEntitiesAsync(new TableQuery <KindActionAzure>().Where(filter)); foreach (var kindActionAzure in kindActions) { kindActionAzure.PartitionKey = kindActionAzure.Id; kindActionAzure.RowKey = "KindAction"; try { await _azureManager.DeleteEntityAsync(kindActionAzure); } catch { //do nothing } } }
/// <summary> /// Deletes the appErrorInfo. /// </summary> /// <param name="id"> /// The identifier. /// </param> /// <returns> /// Task{OperationResult}. /// </returns> public async Task <OperationResult> DeleteAppErrorInfo(string id) { var appErrorInfoAzure = await _azureManager.GetEntityByIdAndRowKeyAsync <AppErrorInfoAzure>(id, AzureTableConstants.AppErrorInfoRowKey); if (appErrorInfoAzure != null) { var result = await _azureManager.DeleteEntityAsync(appErrorInfoAzure); return(result); } return(new OperationResult(OperationResultStatus.Warning, "No entity to delete")); }
/// <summary> /// Deletes the alias. /// </summary> /// <param name="aliasName">Name of the alias.</param> /// <returns>Task{OperationResult}.</returns> public async Task <OperationResult> DeleteAlias(string aliasName) { var aliasAzure = await _azureManager.GetEntityByIdAndRowKeyAsync <CommonPlaceAliasAzure>( AzureTableConstants.CommonPlacesAliasesPartitionKey, aliasName.DecreaseFullName()); if (aliasAzure == null) { var message = $"Can't find alias {aliasName}"; return(new OperationResult(OperationResultStatus.Error, message)); } return(await _azureManager.DeleteEntityAsync(aliasAzure)); }
/// <summary> /// Deletes the missionRequest. /// </summary> /// <param name="id"> /// The identifier. /// </param> /// <returns> /// Task{OperationResult}. /// </returns> public async Task <OperationResult> DeleteMissionRequest(string id) { var entities = await _azureManager.GetEntitiesForCompleteDelete <MissionRequestAzure>(id); if (entities.AnyValues()) { var deletingRequest = entities[0]; var result = await _azureManager.DeleteEntityAsync(deletingRequest); await _imagesProvider.DeleteImages(deletingRequest.ProofImageUrls.SplitStringByDelimiter()); return(result); } return(new OperationResult(OperationResultStatus.Warning, "No entities to delete")); }
/// <summary> /// Deletes the type of the person. /// </summary> /// <param name="id">The id.</param> /// <returns>Task{OperationResult}.</returns> public async Task <OperationResult> DeletePersonQuality(string id) { var personQualityAzure = await _azureManager.GetEntityByIdAndRowKeyAsync <PersonQualityAzure>(id, AzureTableConstants.PersonQualityRowKey); if (personQualityAzure == null) { return(new OperationResult(OperationResultStatus.Error, "No person quality for delete")); } var deleteResult = await _azureManager.DeleteEntityAsync(personQualityAzure); if (deleteResult.Status == OperationResultStatus.Success) { var warnings = new StringBuilder(); foreach (var personQualityDependent in RepositoriesDependentOnPersonQuality) { var refreshMissionDraftsResult = await personQualityDependent.RemoveLinksToDeletedPersonQuality(id); if (refreshMissionDraftsResult.Status != OperationResultStatus.Success) { var warning = $"Links to deleted person quality are not removed from {personQualityDependent.GetType().Name}! "; warnings.AppendLine(warning); } } if (warnings.Length > 0) { return(new OperationResult(OperationResultStatus.Warning, warnings.ToString())); } } return(deleteResult); }