コード例 #1
0
ファイル: KeepsService.cs プロジェクト: SpencerLeBard/Keepr
        internal Keep GetById(string creatorId, int id)
        {
            Keep original = _repo.GetById(id);

            if (original == null)
            {
                throw new Exception("Invalid ID");
            }
            return(original);
        }
コード例 #2
0
ファイル: KeepsService.cs プロジェクト: StevenPackard/fave-it
        public Keep Get(int id)
        {
            var found = _repo.GetById(id);

            if (found.IsPrivate == true)
            {
                throw new Exception("Thats private yo");
            }
            return(found);
        }
コード例 #3
0
        public Keep GetById(int id)
        {
            var data = _krepo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            return(data);
        }
コード例 #4
0
        internal Keep GetById(int id)
        {
            Keep keepData = _repo.GetById(id);

            if (keepData == null)
            {
                throw new Exception("Invalid Id");
            }
            return(keepData);
        }
コード例 #5
0
ファイル: KeepsService.cs プロジェクト: NickBynum/keepr-final
        public Keep GetById(int id)
        {
            Keep foundKeep = _repo.GetById(id);

            if (foundKeep == null)
            {
                throw new Exception("Invalid Id");
            }
            return(foundKeep);
        }
コード例 #6
0
        private Keep Get(int id)
        {
            Keep exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new Exception("Invalid Keep Id");
            }
            return(exists);
        }
コード例 #7
0
        internal Keep GetById(int id)
        {
            var existenceTest = _repo.GetById(id);

            if (existenceTest == null)
            {
                throw new Exception("Bad Id");
            }
            return(existenceTest);
        }
コード例 #8
0
ファイル: KeepsService.cs プロジェクト: JD-Fuller/keepr
        internal Keep GetById(int id)
        {
            var exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new Exception("Invalid ID");
            }
            return(exists);
        }
コード例 #9
0
        internal Keep GetPublicKeepById(int id)
        {
            var found = _repo.GetById(id);

            if (found == null)
            {
                throw new Exception("Invalid Id");
            }
            return(_repo.GetPublicKeepById(id));
        }
コード例 #10
0
        internal Keep GetById(int keepId)
        {
            var data = _repo.GetById(keepId);

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

            return(data);
        }
コード例 #11
0
ファイル: KeepsService.cs プロジェクト: JustinBarnard1/keepr
        internal ViewModelKeep GetById(string profileId, int keepId)
        {
            _repo.AddView(keepId);
            ViewModelKeep original = _repo.GetById(keepId);

            if (original == null)
            {
                throw new Exception("Invalid Id");
            }
            return(original);
        }
コード例 #12
0
ファイル: KeepsService.cs プロジェクト: SamuelJTaylor22/Keepr
        internal Keep GetById(int id)
        {
            Keep found = _repo.GetById(id);

            found.Views = found.Views + 1;
            _repo.Edit(found);
            if (found == null)
            {
                throw new Exception("Invalid Id");
            }
            return(found);
        }
コード例 #13
0
ファイル: KeepsService.cs プロジェクト: LeviSmithCodes/Keepr
        internal object GetById(int id, string userId)
        {
            Keep exists = _repo.GetById(id, userId);

            if (exists == null)
            {
                throw new Exception("Invalid Id");
            }
            // I don't know why this threw an error when the delete didn't (maybe it created it's own?)... oh wait, I don't want thsi logic. Duh. Ppl should be able to see the public posts of others by Id.
            // if (exists.UserId != userId) { throw new Exception("Cannot get things you did not create"); }
            return(exists);
        }
コード例 #14
0
        internal Keep GetById(int id)
        {
            var exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new Exception("Invalid Id");
            }
            exists.Views++;
            _repo.Edit(exists);
            return(exists);
        }
コード例 #15
0
ファイル: KeepsService.cs プロジェクト: AdamCoryat/keepr
        internal Keep GetById(int id)
        {
            Keep data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            data.Views++;
            Keep incremented = _repo.Edit(data);

            return(incremented);
        }
コード例 #16
0
        internal Keep GetById(int keepId, string userId)
        {
            var exists = _repo.GetById(keepId);

            if (exists == null)
            {
                throw new Exception("Invalid Id");
            }
            else if (exists.IsPrivate == true && exists.UserId != userId)
            {
                throw new Exception("You can't access this");
            }
            return(exists);
        }
コード例 #17
0
        public Keep GetById(int id, string userId)
        {
            var exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new Exception("Invalid ID");
            }
            if (exists.IsPrivate == true && userId != exists.UserId)
            {
                throw new Exception("Cannot accesss. This keep is private.");
            }
            return(exists);
        }
コード例 #18
0
        internal Keep GetById(int id)
        {
            var exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new Exception("Invalid id.");
            }
            if (exists.IsPrivate == false)
            {
                return(exists);
            }
            throw new Exception("Can't access private content.");
        }
コード例 #19
0
        internal Keep GetById(int id, string userId)
        {
            var found = _repo.GetById(id);

            if (found == null)
            {
                throw new Exception("Invalid id");
            }
            else if (found.IsPrivate != true && found.UserId != userId)
            {
                throw new Exception("you are not the user");
            }
            return(found);
        }
コード例 #20
0
        internal Keep GetById(int id, string userId)
        {
            var exists = _repo.GetById(id);

            if (exists == null)
            {
                throw new Exception("Invalid ID");
            }
            if (exists.IsPrivate == true && exists.UserId != userId)
            {
                throw new Exception("This post is private and cannot be viewed");
            }
            return(exists);
        }
コード例 #21
0
        internal Keep GetById(int id)
        {
            var exists = _repo.GetById(id);


            if (exists == null)
            {
                throw new Exception("Invalid Id, or private");
            }
            else if (exists.IsPrivate == true)
            {
                throw new Exception("This keep is Private");
            }
            return(exists);
        }
コード例 #22
0
ファイル: KeepsService.cs プロジェクト: ricejl/keepr
        internal Keep GetById(int id, string userId)
        {
            var found = _repo.GetById(id);

            if (found == null)
            {
                throw new Exception("Invalid id");
            }
            // if found.isPrivate is true and userId doesn't match found.UserId, throw error
            if (found.IsPrivate && userId != found.UserId)
            {
                throw new Exception("Must be logged in to see private keeps");
            }
            return(found);
        }
コード例 #23
0
        public Keep GetById(int id)
        {
            Keep foundKeep = _repo.GetById(id);

            if (foundKeep.IsPrivate)
            {
                throw new Exception("Invalid Keep Id/Not Public.");
            }
            return(foundKeep);
        }
コード例 #24
0
        public Keep GetById(string userId, int id)
        {
            Keep foundKeep = _repo.GetById(id);

            if (foundKeep.IsPrivate)
            {
                Keep foundPrivateKeep = _repo.GetPrivateById(userId, id);
                if (foundPrivateKeep == null)
                {
                    throw new Exception("Invalid User");
                }
                return(foundPrivateKeep);
            }
            if (foundKeep == null)
            {
                throw new Exception("Invalid Keep Id");
            }
            return(foundKeep);
        }
コード例 #25
0
        internal Keep GetById(int id)
        {
            Keep data = _keepsRepo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Id");
            }
            return(data);
        }
コード例 #26
0
ファイル: KeepsService.cs プロジェクト: Dakota-Logan/keppr
        public Keep Create(Keep newKeep)
        {
            newKeep.Views  = 0;
            newKeep.Keeps  = 0;
            newKeep.Shares = 0;

            int newId = _repo.Create(newKeep);

            return(_repo.GetById(newId));
        }
コード例 #27
0
        //passses an id to repo to return a single keep
        internal Keep 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);
        }
コード例 #28
0
        public Keep GetById(int id)
        {
            Keep foundKeep = _repo.GetById(id);

            if (foundKeep == null)
            {
                throw new Exception("No Keep found under that id.");
            }
            return(foundKeep);
        }
コード例 #29
0
ファイル: KeepsService.cs プロジェクト: spenserdavies/keeprr
        internal Keep GetById(int id) //Get by Id
        {
            Keep foundKeep = _repo.GetById(id);

            if (foundKeep == null)
            {
                throw new Exception("Invalid Id");
            }
            return(foundKeep);
        }
コード例 #30
0
        public Keep GetById(int id, string userId)
        {
            Keep k = _repo.GetById(id, userId);

            if (k == null)
            {
                throw new Exception("Can't get that keep.");
            }
            return(k);
        }