internal Vault Get(int id, string userId)
        {
            Vault exists = _repo.GetById(id);

            if (exists == null || exists.UserId != userId)
            {
                throw new Exception("Invalid Vault Id");
            }
            return(exists);
        }
Exemple #2
0
        internal Vault Get(int id, string userId)
        {
            Vault foundVault = _repo.GetById(id, userId);

            if (foundVault == null)
            {
                throw new Exception("Invalid Id");
            }
            return(foundVault);
        }
Exemple #3
0
        internal Vault GetById(int id)
        {
            var data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            else if (data.IsPrivate == true)
            {
                throw new Exception("This vault is private and you are not the creator");
            }
            return(data);
        }
Exemple #4
0
        internal Vault GetById(int id, string userId)
        {
            Vault found = _repo.GetById(id, userId);

            if (found == null)
            {
                throw new Exception("no vault found with that id");
            }
            if (found.UserId == userId)
            {
                return(_repo.GetById(id, userId));
            }
            throw new Exception("something when wrong");
        }
        internal Vault Get(int id, Profile userInfo)
        {
            var data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id Aye");
            }
            if (data.IsPrivate == true && data.CreatorId != userInfo?.Id)
            {
                throw new Exception("Get outta here, this is private");
            }
            return(data);
        }
Exemple #6
0
        internal Vault GetById(int id)
        {
            Vault vault = _repo.GetById(id);

            if (vault == null)
            {
                throw new Exception("Bad Vault Id");
            }
            if (vault.IsPrivate)
            {
                throw new Exception("This Vault is private");
            }
            return(vault);
        }
Exemple #7
0
        internal Vault GetById(int id, string userId)
        {
            Vault data = _vrepo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid ID");
            }
            else if (data.IsPrivate == true && userId != data.CreatorId)
            {
                throw new Exception("Access Denied: This Vault is Private");
            }
            return(data);
        }
Exemple #8
0
        internal Vault GetById(string userId, int id)
        {
            Vault data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            if (data.CreatorId != userId && data.IsPrivate == true)
            // if(data.IsPrivate && data.CreatorId != userId)
            {
                throw new Exception("Unable to view private vaults");
            }
            return(data);
        }
Exemple #9
0
        public Vault GetById(int id, string userId)
        {
            var foundVault = Get(id);

            if (foundVault.UserId != userId)
            {
                throw new Exception("Ah ah ah, you didn't say the magic word");
            }
            return(_repo.GetById(id, userId));
        }
Exemple #10
0
        internal Vault GetById(int vaultId)
        {
            Vault foundVault = _repo.GetById(vaultId);

            if (foundVault == null)
            {
                throw new Exception("Invalid Id");
            }
            return(foundVault);
        }
        public ActionResult <Vault> Get(int id)
        {
            Vault found = _vr.GetById(id);

            if (found == null)
            {
                return(BadRequest("No vault found"));
            }
            return(Ok(found));
        }
Exemple #12
0
        internal IEnumerable <VaultKeepView> GetKeepsByVaultId(int id, string userId)
        {
            Vault vault = _vrepo.GetById(id);

            if (vault.IsPrivate == true && vault.CreatorId != userId)
            {
                throw new Exception("This is private and you are not the creator");
            }
            return(_repo.GetKeepsByVaultId(id));
        }
        public ActionResult <IEnumerable <Vault> > GetById(string vaultId)
        {
            IEnumerable <Vault> result = _vr.GetById(vaultId);

            if (result == null)
            {
                return(BadRequest());
            }
            else
            {
                return(Ok(result));
            }
        }
Exemple #14
0
        internal Vault GetById(int id, string userId)
        {
            var data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            if (data.CreatorId != userId && data.IsPrivate)
            {
                throw new Exception("This is private and youre not the owner.");
            }
            return(data);
        }
Exemple #15
0
        internal Vault GetById(int id, string userId)
        {
            var data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            else if (data.CreatorId != userId & data.IsPrivate)
            {
                throw new Exception("Not authorized!");
            }
            return(data);
        }
Exemple #16
0
        ///<summary>
        ///Creates new Vault-Keep, if the vault is null it will throw an error, if you are not the original
        /// creator, an error will be thrown.
        ///</summary>
        internal VaultKeep Create(VaultKeep newVaultKeep)
        {
            Vault vault = _vrepo.GetById(newVaultKeep.VaultId);

            if (vault == null)
            {
                throw new Exception("Not a valid vault dude");
            }
            if (vault.CreatorId != newVaultKeep.CreatorId)
            {
                throw new Exception("You are not the owner of this vault buddy");
            }

            return(_repo.Create(newVaultKeep));
        }
Exemple #17
0
 public ActionResult <Vault> GetActionResult(string id)
 {
     return(_vr.GetById(id));
 }