コード例 #1
0
ファイル: VaultKeepsService.cs プロジェクト: Inlic/keepr
        public VaultKeep GetById(int id)
        {
            var data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            return(data);
        }
コード例 #2
0
        internal IEnumerable <Keep> GetById(Vault v)
        {
            var found = _repo.GetById(v);

            // if (found == null) { throw new Exception("Invalid id"); }
            // if (found.ElementAt(0).UserId != userId) { throw new Exception("Unauthorized"); }
            return(found);
        }
コード例 #3
0
        public VaultKeep GetById(int Id)
        {
            VaultKeep exists = _repo.GetById(Id);

            if (exists == null)
            {
                throw new Exception("Invalid keep id");
            }
            return(exists);
        }
コード例 #4
0
        internal IEnumerable <Keep> GetById(int vid, string userId)
        {
            var found = _repo.GetById(vid, userId);

            if (found == null)
            {
                throw new Exception("Invalid id");
            }
            return(found);
        }
コード例 #5
0
        private DTOVaultKeep GetById(int id)
        {
            var found = _repo.GetById(id);

            if (found == null)
            {
                throw new Exception("Invalid Id");
            }
            return(found);
        }
コード例 #6
0
        internal VaultKeep GetById(int id)
        {
            var res = _repo.GetById(id);

            if (res == null)
            {
                throw new System.Exception("Bad id, please check your input and try again");
            }
            return(res);
        }
コード例 #7
0
        internal void Delete(int id)
        {
            var data = _repo.GetById(id);

            // if (data == null)
            // {
            //   throw new Exception("Invalid Id");
            // }
            _repo.Delete(id);
        }
コード例 #8
0
        // internal void Create(VaultKeep newVaultKeep)
        // {
        //   VaultKeep existence = _repo.Find(newVaultKeep);
        //   if (existence != null) { return; }
        //   _repo.Create(newVaultKeep);
        // }



        internal VaultKeep GetById(int id)
        {
            var existenceTest = _repo.GetById(id);

            if (existenceTest == null)
            {
                throw new Exception("Bad Id");
            }
            return(existenceTest);
        }
コード例 #9
0
        public DTOVaultedKeep Get(int Id)
        {
            DTOVaultedKeep found = _repo.GetById(Id);

            if (found == null)
            {
                throw new Exception("Keep cannot be placed in vault");
            }
            return(found);
        }
コード例 #10
0
        public VaultKeep GetById(int id)
        {
            VaultKeep foundVK = _repo.GetById(id);

            if (foundVK == null)
            {
                throw new Exception("Invalid VaultKeep Id");
            }
            return(foundVK);
        }
コード例 #11
0
        internal DTOVaultKeep GetById(int id) //TODO call in a different controller than VKC
        {
            DTOVaultKeep exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new Exception("ur wrong bub");
            }
            return(exists);
        }
コード例 #12
0
        public VaultKeep Get(int id, string userId)
        {
            VaultKeep exists = _repo.GetById(id, userId);

            if (exists == null)
            {
                throw new Exception("Wrong Keep Bud!");
            }
            return(exists);
        }
コード例 #13
0
        public VaultKeep GetById(int id)
        {
            VaultKeep foundVaultKeep = _repo.GetById(id);

            if (foundVaultKeep == null)
            {
                throw new Exception("invalid id");
            }
            return(foundVaultKeep);
        }
コード例 #14
0
ファイル: VaultKeepsService.cs プロジェクト: JD-Fuller/keepr
        public string Delete(int vaultId, int keepId, string userId)
        {
            var exists = _repo.GetById(vaultId, keepId, userId);

            if (exists == null)
            {
                throw new Exception("Invalid request");
            }
            _repo.Delete(vaultId, keepId, userId);
            return("Successfully Deleted");
        }
コード例 #15
0
        internal object Delete(int id, Profile userInfo)
        {
            VaultKeep data = _repo.GetById(id);

            if (data.CreatorId != userInfo.Id || data == null)
            {
                throw new Exception("Invalid Id, Or Invalid Permissions");
            }
            _repo.Delete(id);
            return("Successfully Deleted!");
        }
コード例 #16
0
        internal string Delete(int id)
        {
            var exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new Exception("Invalid id combination");
            }
            _repo.Delete(id);
            return("Successfully Deleted");
        }
コード例 #17
0
        internal void Delete(int id, string userId)
        {
            VaultKeep original = _repo.GetById(id);

            if (original == null)
            {
                throw new Exception("Invalid Id");
            }
            if (original.CreatorId != userId)
            {
                throw new Exception("You cannot delete that which is not yours.");
            }
            _repo.Delete(id);
        }
コード例 #18
0
        public VaultKeep Get(int id, string userId)
        {
            VaultKeep exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new System.Exception("VaultKeep does not exist!");
            }
            if (exists.userId != userId)
            {
                throw new System.Exception("VaultKeep does not belong to you.");
            }
            return(exists);
        }
コード例 #19
0
        internal void Delete(int id, string userId)
        {
            var vk = _repo.GetById(id);

            if (vk == null)
            {
                throw new Exception("Invalid Id");
            }
            if (vk.CreatorId != userId)
            {
                throw new Exception("Access Denied");
            }
            _repo.Delete(id);
        }
コード例 #20
0
        public VaultKeepViewModel GetById(int id, string userId)
        {
            VaultKeepViewModel foundVaultKeep = _repo.GetById(id, userId);

            if (foundVaultKeep == null)
            {
                throw new Exception("Invalid Id");
            }
            if (foundVaultKeep.UserId != userId)
            {
                throw new Exception("This is not yours!");
            }
            return(foundVaultKeep);
        }
コード例 #21
0
ファイル: VaultKeepsService.cs プロジェクト: davidwfolk/keepr
        internal VaultKeep Delete(int id, string userId)
        {
            VaultKeep foundVaultKeep = _repo.GetById(id);

            if (foundVaultKeep.UserId != userId)
            {
                throw new Exception("This is not your VaultKeep!");
            }
            if (_repo.Delete(id))
            {
                return(foundVaultKeep);
            }
            throw new Exception("Need a mulligan on deleting this VaultKeep?");
        }
コード例 #22
0
        internal string Delete(int vaultId, int keepId, string userId)
        {
            VaultKeep exists = _repo.GetById(vaultId, keepId, userId);

            if (exists == null)
            {
                throw new Exception("Invalid Id Delete");
            }
            else if (exists.UserId != userId)
            {
                throw new Exception("This isnt yours, so you cant delete it!");
            }
            _repo.Delete(vaultId, keepId, userId);
            return("This thing is gone!");
        }
コード例 #23
0
        internal VaultKeep Delete(int id, string userInfoId)
        {
            VaultKeep data = _vaultKeepRepo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            if (data.CreatorId != userInfoId)
            {
                throw new Exception("Invalid Edit Permissions");
            }
            _vaultKeepRepo.Delete(id);
            return(data);
        }
コード例 #24
0
        internal string Delete(int vaultId, int keepId, string userId)
        {
            var exists = _vaultKeepRepo.GetById(vaultId, keepId);

            if (exists == null)
            {
                throw new Exception("Item Does not Exist");
            }
            else if (exists.UserId != userId)
            {
                throw new Exception("not yours to delete killer");
            }
            _vaultKeepRepo.Delete(exists.Id);
            return("VaultKeep has been deleted!");
        }
コード例 #25
0
        public string Delete(int vaultId, int keepId, string userId)
        {
            var exists = _repo.GetById(vaultId, keepId);

            if (exists == null)
            {
                throw new Exception("INVALID ID COMBO");
            }
            else if (exists.UserId != userId)
            {
                throw new Exception("THIS AINT YOURS FOOL!");
            }
            _repo.Delete(exists.Id);
            return("SHE GONE");
        }
コード例 #26
0
        internal string Delete(int id, string userId)
        {
            VaultKeep original = _repo.GetById(id);

            if (original == null)
            {
                throw new Exception("Invalid Id");
            }
            if (original.CreatorId != userId)
            {
                throw new Exception("You can only delete your own Keeps");
            }
            _repo.Delete(id);
            return("removed from list");
        }
コード例 #27
0
        internal void Create(VaultKeep newData)
        {
            VaultKeep exists = _repo.GetById(newData.Id);

            if (exists != null)
            {
                throw new Exception("Relationship already exists");
            }
            // Pretty sure I don't need this on create...
            // else if (exists.UserId != newData.UserId)
            // {
            //   throw new Exception("");
            // }
            _repo.Create(newData);
        }
コード例 #28
0
        internal object DeleteVaultKeep(int id, string userId)
        {
            VaultKeep data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id... from vaultkeepsService");
            }

            if (data.CreatorId != userId)
            {
                throw new Exception("Access Denied NOT YOURS... from vaultkeepsService");
            }
            _repo.DeleteVaultKeep(id);
            return("Successfully deleted... from vaultkeepsService");
        }
コード例 #29
0
        internal VaultKeep Delete(string userId, int queryId)
        {
            var data = _repo.GetById(queryId);

            if (data == null)
            {
                throw new Exception("invalid Id");
            }
            if (data.CreatorId != userId)
            {
                throw new Exception("This is not yours");
            }
            var deleted = _repo.Delete(queryId);

            return(deleted);
        }
コード例 #30
0
 // public IEnumerable<VaultKeepViewModel> Get(string userId)
 // {
 //   return _repo.Get(userId);
 // }
 public VaultKeep Get(int id)
 {
     return(_repo.GetById(id));
 }