I'm fiddling around with this tutorial.
After deploying and setting up the contract within the page, I created a proposal from the ethereum wallet which I could see after a few blocks. The read from contracts part shows all proposals, available by their number. This implies that the proposals are available readily somewhere but I want to know how to geth them via nethereum.
I have the contract ready as below.
contract = web3.Eth.GetContract(abi, contractAddress);
How can I get the data?
Best Answer
The Nethereum.Web.Sample shows you how to interact with the DAO.
In the sample there is a generic DAO service Source code in Github
A simple pattern to create a contract service, is to instantiate it with your Web3 class and ABI.
The DAO stores the total number of proposals by declaring a public attribute, this can be accessed as follows:
If you want to retrieve all the Proposals you can iterate from 0 to the total number of proposals and add them to a collection as:
What is missing above is how to get that specific Proposal data to so you can call the function "proposals" this is in solidity the "mapping" of the proposal number and the struct proposal, which are output parameters.
Above you may have noticed the output is deserialised into a Proposal Object, this is the FunctionOuput and requires information (from the ABI) to do the deserialisation.