internal IEnumerable <VaultKeepModel> GetByVault(int id, string userId) { Vault curVault = _vService.Get(id, userId); if (curVault == null) { throw new Exception("Could not find this vault."); } if (curVault.IsPrivate == true && userId != curVault.CreatorId) { throw new Exception("You don't have access to this."); } return(_vkRepo.GetByVaultId(id)); }
internal string DeleteAsync(int vaultKeepId, string userId) { VaultKeep originalVK = _vkRepo.Get(vaultKeepId); Vault original = _vService.Get(originalVK.VaultId, userId); Keep originalKeep = _kService.Get(originalVK.KeepId); Console.WriteLine("yo" + originalKeep.Id); if (userId != original.CreatorId) { throw new Exception("You can't access this."); } _vkRepo.Delete(vaultKeepId, originalKeep.Id); return("deleted"); }