コード例 #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
ファイル: KeepsService.cs プロジェクト: ChrisJCurry/keepr
        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));
 }