internal VaultKeep Get(int id) { var data = _repo.Get(id); if (data == null) { throw new Exception("Invalid Id"); } return(data); }
internal string DeleteAsync(int vaultKeepId, string userId) { VaultKeep originalVK = _vkRepo.Get(vaultKeepId); Vault original = _vService.Get(originalVK.VaultId, userId); Keep originalKeep = _kService.Get(originalVK.KeepId); Console.WriteLine("yo" + originalKeep.Id); if (userId != original.CreatorId) { throw new Exception("You can't access this."); } _vkRepo.Delete(vaultKeepId, originalKeep.Id); return("deleted"); }
public string Delete(int id, string userId) { VaultKeep original = _repo.Get(id); if (original == null) { throw new Exception("Incorrect Id"); } else if (original.CreatorId != userId) { throw new Exception("Not allowed"); } else if (_repo.Remove(id)) { return("Deleted"); } return("Could not delete"); }
public string Delete(int id, string userId) { VaultKeep original = _repo.Get(id); if (original == null) { throw new Exception("Bad Id"); } if (original.CreatorId != userId) { throw new Exception("Not the User : Access Denied"); } if (_repo.Delete(id)) { return("deleted succesfully"); } return("did not remove succesfully"); }
internal string Delete(int id, string userId) { VaultKeep selectedVaultKeep = _repo.Get(id); if (selectedVaultKeep == null) { throw new Exception("Bad Id"); } if (selectedVaultKeep.CreatorId != userId) { throw new Exception("Not Your VaultKeep"); } if (_repo.Remove(id)) { return("Great Success!"); } return("Much Failure"); }
public IEnumerable <VaultKeep> Get() { return(_vaultKeepsRepository.Get()); }
internal IEnumerable <VaultKeep> Get() { return(_repo.Get()); }
internal VaultKeep Get(int id) { VaultKeep vk = _vkRepo.Get(id); return(vk); }
public IEnumerable <VaultKeep> Get() { return(_repo.Get()); }