コード例 #1
0
        public IEnumerable <Keep> Get()
        {
            var exists = _repo.Get();

            if (exists == null)
            {
                throw new Exception("There are no keeps");
            }
            return(exists);
        }
コード例 #2
0
ファイル: KeepsService.cs プロジェクト: jraitter/mykeepr
 internal Keep Get(int Id)
 {
   //NOTE If you do not null check you could get a 204 (No Context) if the blog was not found
   Keep found = _repo.Get(Id);
   if (found == null)
   {
     throw new Exception("Invalid Id");
   }
   return found;
 }
コード例 #3
0
        /// <summary>
        /// creates a new relation. checks for private / public
        /// </summary>
        /// <param name="newRelation">a vaultKeep object representign the new assiciation</param>
        /// <param name="userId">the user trying to create the association</param>
        internal VaultKeep Create(VaultKeep newRelation, string userId)
        {
            Keep foundKeep = _krepo.Get(newRelation.KeepId, false);

            // two states:
            // found, is private, not created by person makign the request
            // found, not private

            if (foundKeep.IsPrivate && foundKeep.UserId != userId)
            {
                throw new ArgumentNullException(nameof(newRelation.KeepId), "That Keep does not exist");
            }
            // found is public or we made it and it is private

            // _vrepo.Get does userId checking internally
            Vault foundVault = _vrepo.Get(newRelation.VaultId, userId);


            newRelation.UserId = userId;
            return(_repo.Create(newRelation));
        }
コード例 #4
0
 public List <Keep> Get()
 {
     return(_krepo.Get());
 }
コード例 #5
0
ファイル: KeepsService.cs プロジェクト: mralext20/keepr
 public IEnumerable <Keep> Get()
 {
     return(_repo.Get());
 }
コード例 #6
0
 internal IEnumerable <Keep> Get()
 {
     return(_repo.Get());
 }
コード例 #7
0
ファイル: KeepsService.cs プロジェクト: spenserdavies/keeprr
 public IEnumerable <Keep> Get() //Get All
 {
     return(_repo.Get());
 }
コード例 #8
0
 public IEnumerable <Keep> Get()
 {
     return(_kr.Get());
 }