Beispiel #1
0
        internal Vault GetOne(int vaultId)
        {
            Vault vault = _repo.Get(vaultId);

            if (vault == null)
            {
                throw new Exception("invalid id");
            }
            if (vault.IsPrivate)
            {
                throw new Exception("not authorized");
            }
            return(vault);
        }
Beispiel #2
0
        public IEnumerable <Keep> GetKeeps(int vaultId, string userId)
        {
            Vault vault = _vaultrepo.Get(vaultId);

            if (vault == null || vault.UserId != userId)
            {
                throw new Exception("Invalid Request");
            }
            return(_repo.GetKeeps(vaultId, userId));
        }
        internal Vault Get(int id)
        {
            var data = _repo.Get(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            return(data);
        }
Beispiel #4
0
        internal VaultKeep Create(VaultKeep newVaultKeep, string userId)
        {
            Vault vault = _vrepo.Get(newVaultKeep.VaultId);
            Keep  keep  = _krepo.GetOne(newVaultKeep.KeepId);

            if (keep == null)
            {
                throw new Exception("invalid keep id");
            }
            if (vault == null)
            {
                throw new Exception("invalid vault id");
            }
            if (vault.CreatorId != userId)
            {
                throw new Exception("you are not the owner of this vault");
            }
            int id = _repo.Create(newVaultKeep);

            newVaultKeep.Id = id;
            keep.Keeps      = keep.Keeps + 1;
            _krepo.AddKeep(keep);
            return(newVaultKeep);
        }
Beispiel #5
0
 public IEnumerable <Vault> Get(string userId)
 {
     return(_repo.Get().ToList().FindAll(v => v.CreatorId == userId));
 }
Beispiel #6
0
 public IEnumerable <Vault> Get()
 {
     return(_vaultsRepository.Get());
 }
Beispiel #7
0
 internal IEnumerable <Vault> Get(string profileId)
 {
     return(_repo.Get(profileId).ToList().FindAll(vault => vault.CreatorId == profileId || !vault.IsPrivate));
 }
Beispiel #8
0
 public IEnumerable <Vault> Get(string userId)
 {
     return(_repo.Get(userId));
 }
Beispiel #9
0
        internal IEnumerable <Vault> Get()
        {
            IEnumerable <Vault> vaults = _vRepo.Get();

            return(vaults);
        }
Beispiel #10
0
 public Vault Get(int id)
 {
     return(_repo.Get(id));
 }
Beispiel #11
0
 internal IEnumerable <Vault> Get(string userId)
 {
     return(_repo.Get(userId));
 }
Beispiel #12
0
 public IEnumerable <Vault> Get()
 {
     return(_repo.Get());
 }