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); }
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); }
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); }
public IEnumerable <Vault> Get(string userId) { return(_repo.Get().ToList().FindAll(v => v.CreatorId == userId)); }
public IEnumerable <Vault> Get() { return(_vaultsRepository.Get()); }
internal IEnumerable <Vault> Get(string profileId) { return(_repo.Get(profileId).ToList().FindAll(vault => vault.CreatorId == profileId || !vault.IsPrivate)); }
public IEnumerable <Vault> Get(string userId) { return(_repo.Get(userId)); }
internal IEnumerable <Vault> Get() { IEnumerable <Vault> vaults = _vRepo.Get(); return(vaults); }
public Vault Get(int id) { return(_repo.Get(id)); }
internal IEnumerable <Vault> Get(string userId) { return(_repo.Get(userId)); }
public IEnumerable <Vault> Get() { return(_repo.Get()); }