Beispiel #1
0
        public string Delete(int id, string userId)
        {
            VaultKeep found = _repo.GetVaultKeepById(id);

            if (found == null || found.CreatorId != userId)
            {
                throw new Exception("Invalid Request");
            }
            if (_repo.Delete(id))
            {
                return("Successfully Deleted!");
            }
            return("Unsuccessful Deletion");
        }
        internal IEnumerable <VaultKeep> GetVaultKeepById(int id, string userId)
        {
            var exists = _repo.GetVaultKeepById(id, userId);

            if (exists == null)
            {
                throw new Exception("Invalid Id");
            }
            return(exists);
        }
Beispiel #3
0
        // NOTE Get Requests
        public VaultKeep GetVaultKeepById(int id)
        {
            VaultKeep foundVaultKeep = _repo.GetVaultKeepById(id);

            if (foundVaultKeep == null)
            {
                throw new Exception("Invalid Id");
            }
            return(foundVaultKeep);
        }