Esempio n. 1
0
        internal VaultKeep Edit(int id, VaultKeep data, Profile userInfo)
        {
            VaultKeep original = _vaultKeepsRepository.GetOne(id, userInfo);

            if (original == null)
            {
                throw new Exception("Cannot find <VaultKeep> with that <Id>");
            }
            if (original.CreatorId != userInfo.Id)
            {
                throw new Exception("Invalid <VaultKeep> creator");
            }
            _vaultKeepsRepository.Edit(id, data);
            return(_vaultKeepsRepository.GetOne(id, userInfo));
        }
Esempio n. 2
0
        internal VaultKeep Edit(VaultKeep editedVaultKeep, Profile userInfo)
        {
            VaultKeep original = _repo.GetOne(editedVaultKeep.Id);

            if (original == null)
            {
                throw new Exception("Does not exist");
            }
            if (original.CreatorId != userInfo.Id)
            {
                throw new Exception("Access Denied");
            }
            _repo.Edit(editedVaultKeep);
            return(_repo.GetOne(editedVaultKeep.Id));
        }