示例#1
0
//Passes an id to the repository to delete
        internal string Delete(int id, string userId)
        {
            var res = GetById(id, userId);

            if (res.CreatorId != userId)
            {
                throw new System.Exception("Credential mismatch, please confirm you have permission to do this");
            }
            _repo.DeleteVault(id);
            return("Vault @res.name has been deleted");
        }
示例#2
0
        internal object DeleteVault(int id, string userId)
        {
            Vault original = _repo.GetById(id);

            if (original == null)
            {
                throw new Exception("Invalid Id... from vaultsService");
            }

            if (original.CreatorId != userId)
            {
                throw new Exception("Access Denied NOT YOURS... from vaultsService");
            }

            _repo.DeleteVault(id);
            return("Successfully deleted... from vaultsService");
        }
示例#3
0
 public bool DeleteVault(string userId, int vaultId)
 {
     return(_repo.DeleteVault(userId, vaultId));
 }