Beispiel #1
0
        internal string DeleteKeep(string userId, int keepId)
        {
            var keep = isKeepOwner(userId, keepId);

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

            if (!successful)
            {
                return(BadRequest("Delete failed!"));
            }
            return(Ok());
        }
        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");
        }
Beispiel #5
0
        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");
        }
        // 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?");
        }
Beispiel #7
0
        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");
        }
Beispiel #8
0
        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");
        }
Beispiel #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");
        }
Beispiel #10
0
        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");
        }
Beispiel #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!");
            }
        }
Beispiel #12
0
        // 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");
            }
        }
        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");
        }
Beispiel #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");
        }
Beispiel #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");
        }
Beispiel #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>");
            }
        }
Beispiel #17
0
        // public Keep Update(Keep keep)
        // {
        //   return _repo.Update(keep);
        // }

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