Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Product {
- string concept;
- uint256 quantity;
- }
- mapping (uint => Product) allProducts;
- uint[] public productDates;
- function setProduct(string _concept, uint256 _quantity, uint _date) public {
- var newproduct = allProducts[_date];
- newproduct.concept = _concept;
- newproduct.quantity = _quantity;
- productDates.push(_date) -1;
- }
- function getProducts() view public returns (uint[]) {
- return productDates;
- }
- function getProduct(uint date) view public returns (string, uint256) {
- return (allProducts[date].concept, allProducts[date].quantity);
- }
Add Comment
Please, Sign In to add comment