コード例 #1
0
ファイル: VaultsService.cs プロジェクト: dallenpyrah/keepr
        internal Vault EditOneVault(Vault editVault)
        {
            Vault current = GetOneVault(editVault.Id);

            if (current == null)
            {
                throw new SystemException("Invalid Id: This vault does not exist or the wrong Id was passed in the put request.");
            }
            if (current.CreatorId != editVault.CreatorId)
            {
                throw new SystemException("You are not the creator of this vault therefore you do not have permission to edit this.");
            }
            editVault.Description = editVault.Description != null ? editVault.Description : current.Description;
            editVault.Name        = editVault.Name != null ? editVault.Name : current.Name;
            editVault.IsPrivate   = editVault.IsPrivate != editVault.IsPrivate ? editVault.IsPrivate : current.IsPrivate;
            return(_vrepo.EditOneVault(editVault));
        }