Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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");
        }