internal object Delete(int vaultId, string userId) { Vault vault = isVaultOwner(userId, vaultId); _repo.Delete(vaultId); return("Delete Successful"); }
internal string Delete(int id) { if (_repo.Delete(id)) { return("deleted successfully"); } throw new Exception ("something went wrong, not deleted"); }
public ActionResult <string> Delete(int id) { bool successful = _vr.Delete(id); if (!successful) { return(BadRequest("Delete failed")); } return(Ok()); }
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"); }
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"); }
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"); }
public string Delete(int id) { Vault exists = _repo.Get(id); if (exists == null) { throw new Exception("Invalid Id"); } _repo.Delete(id); return("Successfully Deleted"); }
// 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."); }
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"); }
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..."); }
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."); }
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"); }
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"); }
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); } }
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"); }
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"); }
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"); } }
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>"); } }
// public Vault Update(Vault vault) // { // return _repo.Update(vault); // } public bool Delete(int id) { return(_repo.Delete(id)); }