/// <inheritdoc />
        public virtual async Task <bool> DeleteAsync <T>(Wallet wallet, string id) where T : RecordBase, new()
        {
            try
            {
                var record = await GetAsync <T>(wallet, id);

                var typeName = new T().TypeName;

                await NonSecrets.DeleteRecordTagsAsync(
                    wallet: wallet,
                    type : typeName,
                    id : id,
                    tagsJson : record.Tags.Select(x => x.Key).ToArray().ToJson());

                await NonSecrets.DeleteRecordAsync(
                    wallet : wallet,
                    type : typeName,
                    id : id);

                return(true);
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Couldn't delete record: {e}");
                return(false);
            }
        }
Example #2
0
        public async Task TestDeleteRecordWorksForTwice()
        {
            await NonSecrets.AddRecordAsync(wallet, type, id, value, tags);

            await NonSecrets.DeleteRecordAsync(wallet, type, id);

            var ex = await Assert.ThrowsExceptionAsync <WalletItemNotFoundException>(() =>
                                                                                     NonSecrets.DeleteRecordAsync(wallet, type, id)
                                                                                     );
        }
 public async Task deleteRecord(string type, string id)
 {
     try
     {
         await NonSecrets.DeleteRecordAsync(d_openWallet, type, id);
     }
     catch (Exception e)
     {
         Console.WriteLine($"Error: {e.Message}");
     }
 }
Example #4
0
        /// <inheritdoc />
        public virtual async Task <bool> DeleteAsync <T>(Wallet wallet, string id) where T : RecordBase, new()
        {
            try
            {
                await NonSecrets.DeleteRecordAsync(wallet,
                                                   new T().TypeName,
                                                   id);

                return(true);
            }
            catch (WalletItemNotFoundException)
            {
                return(false);
            }
        }
Example #5
0
 public async Task TestDeleteRecordWorksForNotFoundRecord()
 {
     var ex = await Assert.ThrowsExceptionAsync <WalletItemNotFoundException>(() =>
                                                                              NonSecrets.DeleteRecordAsync(wallet, type, id)
                                                                              );
 }