示例#1
0
        internal VaultKeep CreateAsync(VaultKeep newVK, string userId)
        {
            List <VaultKeepModel> vk = _vkRepo.GetByVaultId(newVK.VaultId).ToList();

            // List<VaultKeepModel> filtered = vk.Where(vk => vk.Keeps. == newVK.KeepId).ToList();
            // if (filtered.Any())
            // {
            //     throw new Exception("You already added this.");
            // }
            return(_vkRepo.Create(newVK));
        }
示例#2
0
        internal IEnumerable <VaultKeepModel> GetByVault(int id, string userId)
        {
            Vault curVault = _vService.Get(id, userId);

            if (curVault == null)
            {
                throw new Exception("Could not find this vault.");
            }
            if (curVault.IsPrivate == true && userId != curVault.CreatorId)
            {
                throw new Exception("You don't have access to this.");
            }
            return(_vkRepo.GetByVaultId(id));
        }
示例#3
0
 public IEnumerable <Keep> GetByVaultId(int id)
 {
     return(_db.GetByVaultId(id));
 }
示例#4
0
 internal IEnumerable <KeepViewModel> GetByVaultId(int vaultId)
 {
     return(_vksr.GetByVaultId(vaultId));
 }