public Vault GetOne(int id, string userId) { Vault vault = _repo.GetOne(id); if (vault == null) { throw new Exception("Vault not Found"); } if (!vault.IsPublished && vault.creatorId != userId) { throw new Exception("This Vault is Private"); } return(vault); }
public string Create(VaultKeep newVk) { Vault v = _vrepo.GetOne(newVk.VaultId); if (v.creatorId == newVk.CreatorId) { newVk.Id = _vkrepo.Create(newVk); return("relationship created successfully"); } return("this is not your vault to add to"); }