示例#1
0
        internal object Delete(int vaultId, string userId)
        {
            Vault vault = isVaultOwner(userId, vaultId);

            _repo.Delete(vaultId);
            return("Delete Successful");
        }
示例#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 = _vr.Delete(id);

            if (!successful)
            {
                return(BadRequest("Delete failed"));
            }
            return(Ok());
        }
示例#4
0
        internal string Delete(int id, string userId)
        {
            Vault original = _vrepo.GetById(id);

            if (original.CreatorId != userId)
            {
                throw new Exception("You must be the Creator to Delete this");
            }
            _vrepo.Delete(id);
            return("Successfully deleted");
        }
示例#5
0
        internal string Delete(int id, Profile userInfo)
        {
            Vault original = Get(id, userInfo.Id);

            if (userInfo.Id != original.CreatorId)
            {
                throw new Exception("You are not the creator, you can't delete this");
            }
            _vRepo.Delete(id);
            return("Deleted");
        }
示例#6
0
        internal string Delete(int id, string userId)
        {
            var original = GetById(id, userId);

            if (original.CreatorId != userId)
            {
                throw new Exception("Invalid Delete Permissions");
            }
            _repo.Delete(id);
            return("deleted");
        }
        internal Vault Delete(int id, string userId)
        {
            Vault exists = _repo.GetById(id);

            if (exists.UserId == userId)
            {
                _repo.Delete(id);
                return(exists);
            }
            throw new Exception("You cannot delete the given vault");
        }
示例#8
0
        public string Delete(int id)
        {
            Vault exists = _repo.Get(id);

            if (exists == null)
            {
                throw new Exception("Invalid Id");
            }
            _repo.Delete(id);
            return("Successfully Deleted");
        }
示例#9
0
        // Only user/author can delete
        // Probably easier to handle validation in Repository
        // Leaving similar to Keep.Delete for now...since it appears the keepr-testing-tool needs confimation.
        internal string Delete(int id, string userId)
        {
            Vault foundVault = GetVaultById(id, userId);

            if (foundVault.UserId != userId)
            {
                throw new Exception("This is not your Vault!");
            }
            if (_repo.Delete(id, userId))
            {
                return("successfully deleted.");
            }
            throw new Exception("Something unexpected happened.");
        }
示例#10
0
        internal string Delete(int id, string userId)
        {
            Vault foundVault = Get(id);

            if (foundVault.UserId != userId)
            {
                throw new Exception("This is not your vault");
            }
            if (_repo.Delete(id, userId))
            {
                return("Successfully deleted");
            }
            throw new Exception("Not Successfully Deleted");
        }
示例#11
0
        internal string Delete(int id, string userId)
        {
            Vault foundVault = Get(id);

            if (foundVault.UserId != userId)
            {
                throw new Exception("This is not your Vault!");
            }
            if (_repo.Delete(id, userId))
            {
                return("sucessfully Deleted");
            }
            throw new Exception("you broke it...");
        }
示例#12
0
        internal string Delete(int id, string userId)
        {
            Vault foundVault = GetById(id);

            if (foundVault.UserId != userId)
            {
                throw new Exception("This is not your keep!");
            }
            if (_repo.Delete(id, userId))
            {
                return("Successfully Deleted.");
            }
            throw new Exception("Something didn't work.");
        }
示例#13
0
        internal string Delete(int id, string accountId)
        {
            Vault preDelete = _repo.Get(id);

            if (preDelete == null)
            {
                throw new Exception("invalid id");
            }
            if (preDelete.CreatorId != accountId)
            {
                throw new Exception("cannot delete if you are not the creator");
            }
            _repo.Delete(id);
            return("deleted");
        }
示例#14
0
        internal object Delete(int id, string userId)
        {
            Vault data = _repo.GetById(id);

            if (data == null)
            {
                throw new Exception("Invalid Vault ID");
            }
            if (data.CreatorId != userId)
            {
                throw new Exception("Invalid Edit Permissions");
            }
            _repo.Delete(id);
            return("Successfully Deleted");
        }
示例#15
0
        internal bool Delete(int id, string userId)
        {
            Vault found = GetById(id, userId);

            if (found == null)
            {
                throw new NullReferenceException("no vault by that id");
            }
            else if (found.UserId == userId)
            {
                return(_repo.Delete(id));
            }
            else
            {
                return(false);
            }
        }
示例#16
0
        public string Delete(int id, string userId)
        {
            Vault 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");
        }
示例#17
0
        internal string Delete(int id, string userId)
        {
            Vault selectedVault = _repo.GetOne(id);

            if (selectedVault == null)
            {
                throw new Exception("Incorrect ID");
            }
            if (selectedVault.CreatorId != userId)
            {
                throw new Exception("Not Your Vault");
            }
            if (_repo.Delete(id))
            {
                return("Great Success");
            }
            return("Much Failure");
        }
示例#18
0
        internal string Delete(int id, Profile userInfo)
        {
            Vault returnedVault = _repo.GetOne(id);

            if (returnedVault == null)
            {
                throw new Exception("Does not exist");
            }
            if (returnedVault.CreatorId != userInfo.Id)
            {
                throw new Exception("Access Denied");
            }
            if (_repo.Delete(id))
            {
                return("Deleted!");
            }
            else
            {
                return("Failed");
            }
        }
示例#19
0
        internal Boolean Delete(int id, Profile userInfo)
        {
            Vault original = _vaultsRepository.GetOne(id);

            if (original == null)
            {
                throw new Exception("Cannot find <Vault> with that <Id>");
            }
            if (original.CreatorId != userInfo.Id)
            {
                throw new Exception("Invalid <Vault> creator");
            }
            _vaultsRepository.Delete(id);
            original = _vaultsRepository.GetOne(id);
            if (original == null)
            {
                return(true);
            }
            else
            {
                throw new Exception("Failed to delete <Vault>");
            }
        }
示例#20
0
 // public Vault Update(Vault vault)
 // {
 //   return _repo.Update(vault);
 // }
 public bool Delete(int id)
 {
     return(_repo.Delete(id));
 }