Exemplo n.º 1
0
        public void Can_delete_key()
        {
            var folder  = GetFolder("DeleteKey");
            var manager = new VaultManager(folder);

            manager.CreateKeyFiles(true);
            string key   = TestHelper.GenerateValue();
            string value = TestHelper.GenerateValue();

            manager.SetValue(key, value);

            manager.Delete(key);

            var reader = new VaultReader(folder);

            Assert.True(reader[key] == null);
        }
Exemplo n.º 2
0
        public IActionResult DeleteVault(int vaultId)
        {
            ServiceResponse response = new ServiceResponse();

            response.status         = new Status();
            response.status.success = false;
            try
            {
                using (var transaction = context.Database.BeginTransaction())
                {
                    VaultManager manager = new VaultManager(context);
                    manager.Delete(vaultId);
                    response.status.success = true;

                    transaction.Commit();
                }
            }
            catch (Exception exception)
            {
                response.status.errorMessage = exception.Message;
            }
            return(Json(response));
        }