internal VaultKeep Get(int id)
        {
            var data = _repo.Get(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            return(data);
        }
Beispiel #2
0
        internal string DeleteAsync(int vaultKeepId, string userId)
        {
            VaultKeep originalVK   = _vkRepo.Get(vaultKeepId);
            Vault     original     = _vService.Get(originalVK.VaultId, userId);
            Keep      originalKeep = _kService.Get(originalVK.KeepId);

            Console.WriteLine("yo" + originalKeep.Id);
            if (userId != original.CreatorId)
            {
                throw new Exception("You can't access this.");
            }
            _vkRepo.Delete(vaultKeepId, originalKeep.Id);
            return("deleted");
        }
Beispiel #3
0
        public string Delete(int id, string userId)
        {
            VaultKeep original = _repo.Get(id);

            if (original == null)
            {
                throw new Exception("Incorrect Id");
            }
            else if (original.CreatorId != userId)
            {
                throw new Exception("Not allowed");
            }
            else if (_repo.Remove(id))
            {
                return("Deleted");
            }
            return("Could not delete");
        }
Beispiel #4
0
        public string Delete(int id, string userId)
        {
            VaultKeep original = _repo.Get(id);

            if (original == null)
            {
                throw new Exception("Bad Id");
            }
            if (original.CreatorId != userId)
            {
                throw new Exception("Not the User : Access Denied");
            }
            if (_repo.Delete(id))
            {
                return("deleted succesfully");
            }
            return("did not remove succesfully");
        }
Beispiel #5
0
        internal string Delete(int id, string userId)
        {
            VaultKeep selectedVaultKeep = _repo.Get(id);

            if (selectedVaultKeep == null)
            {
                throw new Exception("Bad Id");
            }
            if (selectedVaultKeep.CreatorId != userId)
            {
                throw new Exception("Not Your VaultKeep");
            }
            if (_repo.Remove(id))
            {
                return("Great Success!");
            }
            return("Much Failure");
        }
 public IEnumerable <VaultKeep> Get()
 {
     return(_vaultKeepsRepository.Get());
 }
 internal IEnumerable <VaultKeep> Get()
 {
     return(_repo.Get());
 }
Beispiel #8
0
        internal VaultKeep Get(int id)
        {
            VaultKeep vk = _vkRepo.Get(id);

            return(vk);
        }
Beispiel #9
0
 public IEnumerable <VaultKeep> Get()
 {
     return(_repo.Get());
 }