internal IEnumerable <Keep> GetByVaultId(int vaultId, string userId) { Vault vault = _vr.Find(vaultId); if (vault == null) { throw new Exception("Bad Id"); } if (vault.CreatorId != userId && vault.IsPrivate) { throw new Exception("Not Public.. ask owner to make public?"); } else { return(_repo.Find(vaultId)); } }
internal string Delete(int id, string userId) { Vault data = _repo.Find(id); if (data == null) { throw new Exception("Bad Id"); } if (data.CreatorId != userId) { throw new Exception("Not user, Access Denied"); } if (_repo.Delete(id)) { return("deleted succesfully"); } return("did not remove succesfully"); }