コード例 #1
0
        internal string DeleteKeep(string userId, int keepId)
        {
            var keep = isKeepOwner(userId, keepId);

            _repo.Delete(keepId);
            return("Keep Deleted");
        }
コード例 #2
0
 internal string Delete(int id)
 {
     if (_repo.Delete(id))
     {
         return("deleted successfully");
     }
     throw new Exception
               ("something went wrong, not deleted");
 }
コード例 #3
0
        public ActionResult <string> Delete(int id)
        {
            bool successful = _pr.Delete(id);

            if (!successful)
            {
                return(BadRequest("Delete failed!"));
            }
            return(Ok());
        }
コード例 #4
0
        internal string Delete(int id, string userId)
        {
            var original = GetById(id);

            if (original.CreatorId != userId)
            {
                throw new Exception("Invalid Delete Permissions");
            }
            _repo.Delete(id);
            return("delorted");
        }
コード例 #5
0
ファイル: KeepsService.cs プロジェクト: danielfasula/keepr
        internal string Delete(int id, string userId)
        {
            Keep original = GetById(id);

            if (original.CreatorId != userId)
            {
                throw new Exception("You must be the Creator to Delete this");
            }
            _krepo.Delete(id);
            return("Successfully deleted");
        }
コード例 #6
0
        // Only user/author can delete, and only if isPrivate == true
        internal string Delete(int id, string userId)
        {
            Keep foundKeep = GetKeepById(id, userId);

            if (foundKeep.UserId != userId)
            {
                throw new Exception("This is not your Keep to delete!");
            }
            if (_repo.Delete(id, userId))
            {
                return("Keep successfully deleted.");
            }
            throw new Exception("Public Keeps cannot be deleted! Says who?");
        }
コード例 #7
0
ファイル: KeepsService.cs プロジェクト: ethanvachon/Keepr
        internal string Delete(int keepId, string accountId)
        {
            Keep preDelete = _repo.GetOne(keepId);

            if (preDelete == null)
            {
                throw new Exception("invalid id");
            }
            if (preDelete.CreatorId != accountId)
            {
                throw new NotAuthorized("cannot delete if you are not the creator");
            }
            _repo.Delete(keepId);
            return("deleted");
        }
コード例 #8
0
ファイル: KeepsService.cs プロジェクト: ChrisJCurry/keepr
        internal string Delete(int id, string userId)
        {
            Keep original = Get(id);

            if (userId != original.CreatorId)
            {
                throw new Exception("You are not the creator, you can't delete this");
            }
            if (original == null)
            {
                throw new Exception("You can't delete something that's already deleted.");
            }
            _kRepo.Delete(id);
            return("deleted");
        }
コード例 #9
0
        public string Delete(int id)
        {
            Keep exists = _repo.Get(id);

            if (exists == null)
            {
                throw new Exception("Invalid Id");
            }
            if (exists.IsPrivate == false)
            {
                throw new Exception("You cannot delete a public keep");
            }
            _repo.Delete(id);
            return("Successfully Deleted");
        }
コード例 #10
0
ファイル: KeepsService.cs プロジェクト: JoeAlmanza/keepr
        internal object Delete(int id, string userId)
        {
            var data = GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Keep ID");
            }
            if (data.CreatorId != userId)
            {
                throw new Exception("Invalid Edit Permissions");
            }
            _repo.Delete(id);
            return("Successfully Deleted");
        }
コード例 #11
0
        public string Delete(int id, Profile userInfo)
        {
            Keep original = _repo.GetById(id);

            if (userInfo.Id == original.CreatorId)
            {
                if (_repo.Delete(id))
                {
                    return("This has been deleted!");
                }
                return("Can't delete");
            }
            else
            {
                return("Access not granted!");
            }
        }
コード例 #12
0
ファイル: KeepsService.cs プロジェクト: milesfwilson/keepr
        // internal IEnumerable<Keep> GetKeepsByProfile(string profileId, string userId)
        // {

        //   return _repo.getKeepsByProfile(profileId).ToList().FindAll(keep => keep.CreatorId == userId || keep.IsAvailable);
        // }

        internal string Delete(int id, Profile userInfo)
        {
            Keep returnedKeep = _repo.GetOne(id);

            if (userInfo.Id == returnedKeep.CreatorId)
            {
                if (_repo.Delete(id))
                {
                    return("Deleted!");
                }
                throw new Exception("Unable to be deleted");
            }
            else
            {
                throw new Exception("Access Denied");
            }
        }
コード例 #13
0
        public string Delete(int id, string userId)
        {
            Keep keep = _repo.GetEdit(id);

            if (keep == null)
            {
                throw new Exception("Keep not found");
            }
            if (keep.creatorId != userId)
            {
                throw new Exception("Unauthorized Action");
            }
            if (_repo.Delete(id))
            {
                return("Keep Deleted");
            }
            return("Delete Unsuccessful");
        }
コード例 #14
0
        public string Delete(int id, string userId)
        {
            Keep original = _repo.GetOne(id);

            if (original == null)
            {
                throw new Exception("Incorrect Id");
            }
            else if (original.CreatorId != userId)
            {
                throw new Exception("Not allowed");
            }
            else if (_repo.Delete(id))
            {
                return("Deleted");
            }
            return("Could not delete");
        }
コード例 #15
0
        internal string Delete(int id, string userId)
        {
            Keep selectedKeep = _repo.GetOne(id);

            if (selectedKeep == null)
            {
                throw new Exception("Incorrect ID");
            }
            if (selectedKeep.CreatorId != userId)
            {
                throw new Exception("Not Your Keep");
            }
            if (_repo.Delete(id))
            {
                return("Great Success");
            }
            return("Much Failure");
        }
コード例 #16
0
        internal Boolean Delete(int id, Profile userInfo)
        {
            Keep original = _keepsRepository.GetOne(id);

            if (original == null)
            {
                throw new Exception("Cannot find <Keep> with that <Id>");
            }
            if (original.CreatorId != userInfo.Id)
            {
                throw new Exception("Invalid <Keep> creator");
            }
            _keepsRepository.Delete(id);
            original = _keepsRepository.GetOne(id);
            if (original == null)
            {
                return(true);
            }
            else
            {
                throw new Exception("Failed to delete <Keep>");
            }
        }
コード例 #17
0
ファイル: KeepsService.cs プロジェクト: terryphelps/Keeper
        // public Keep Update(Keep keep)
        // {
        //   return _repo.Update(keep);
        // }

        public bool Delete(int id, string userId)
        {
            return(_repo.Delete(id, userId));
        }