コード例 #1
0
        //   if (toDelete.CreatorId == userInfo.Id)
        //   {
        //     _repo.DeleteVaultKeep(id);
        //     return "Vault Keep deleted";
        //   }
        //   return "Vault Keep could not be deleted";
        // }

        internal object EditVaultKeep(VaultKeep editedVaultKeep, Profile userInfo)
        {
            VaultKeep oldVaultKeep = _repo.GetKeepById(editedVaultKeep.Id);

            if (oldVaultKeep == null)
            {
                throw new Exception("Bad Id");
            }
            if (oldVaultKeep.CreatorId != userInfo.Id)
            {
                throw new Exception("You are not the original poster of the Vault Keep");
            }
            _repo.EditVaultKeep(editedVaultKeep);
            return(_repo.GetKeepById(editedVaultKeep.Id));
        }