private DTOVaultKeep Get(int id)
        {
            DTOVaultKeep exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new Exception("Invalid Vault Id");
            }
            return(exists);
        }
Exemplo n.º 2
0
        public VaultKeep GetById(int id)
        {
            var foundVaultKeep = _repo.GetById(id);

            if (foundVaultKeep == null)
            {
                throw new Exception("Invalid Id");
            }
            return(foundVaultKeep);
        }
Exemplo n.º 3
0
        internal VaultKeep GetById(int id)
        {
            var data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            return(data);
        }
Exemplo n.º 4
0
        internal DTOVaultKeep GetById(int Id)
        {
            DTOVaultKeep exists = _repo.GetById(Id);

            if (exists == null)
            {
                throw new Exception("Invalid VaultKeep");
            }
            return(exists);
        }
Exemplo n.º 5
0
        internal VaultKeep getVaultKeepById(int id)
        {
            VaultKeep vk = _repo.GetById(id);

            if (vk == null)
            {
                throw new Exception("Bad VaultKeep Id");
            }
            return(vk);
        }
Exemplo n.º 6
0
        public DTOVaultKeep GetById(int id)
        {
            DTOVaultKeep exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new Exception("Invalid vaultKeepid");
            }
            return(exists);
        }
Exemplo n.º 7
0
        private VaultKeep GetById(int id)
        {
            VaultKeep found = _repo.GetById(id);

            if (found == null)
            {
                throw new Exception("invalid Id");
            }
            return(found);
        }
Exemplo n.º 8
0
        public ActionResult <VaultKeeps> Get(string userId)
        {
            IEnumerable <VaultKeeps> found = _vkr.GetById(userId);

            if (found == null)
            {
                return(BadRequest());
            }
            return(Ok(found));
        }
Exemplo n.º 9
0
        internal void Delete(int id, string userId)
        {
            VaultKeep vk = _vkrepo.GetById(id);

            if (vk == null)
            {
                throw new Exception("Invalid Id");
            }
            if (vk.CreatorId != userId)
            {
                throw new Exception("Invalid User");
            }
            _vkrepo.Delete(id, vk.KeepId);
        }
Exemplo n.º 10
0
        internal void Delete(int id, string userId)
        {
            VaultKeepViewModel vkm = _repo.GetById(id);

            if (vkm == null)
            {
                throw new Exception("Invalid vkm");
            }
            if (vkm.CreatorId != userId)
            {
                throw new Exception("Invalid User");
            }
            _repo.Delete(id);
        }
Exemplo n.º 11
0
        ///<summary>
        ///Deletes Vault-Keep, checks that the vault-keep is an actual vault-keep, then it checks if the user is
        /// the original creator of said vault-keep.
        ///</summary>
        internal void Delete(int id, string userId)
        {
            VaultKeep keep = _repo.GetById(id);

            if (keep == null)
            {
                throw new Exception("Invalid aye");
            }
            if (keep.CreatorId != userId)
            {
                throw new Exception("Invalid User");
            }
            _repo.Delete(id);
        }
Exemplo n.º 12
0
        public VaultKeep Get(int id, string userId)
        {
            VaultKeep exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new System.Exception("VaultKeep does not exist!");
            }
            if (exists.userId != userId)
            {
                throw new System.Exception("VaultKeep does not belong to you.");
            }
            return(exists);
        }
Exemplo n.º 13
0
        internal void delete(int id, string userId)
        {
            VaultKeep toDelete = _repo.GetById(id);

            if (toDelete == null)
            {
                throw new Exception("invalid id");
            }
            if (toDelete.CreatorId != userId)
            {
                throw new Exception("cannot delete if you are not the creator");
            }
            _repo.Delete(id);
        }