Guest User

Untitled

a guest
Jan 23rd, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. struct Product {
  2. string concept;
  3. uint256 quantity;
  4. }
  5. mapping (uint => Product) allProducts;
  6. uint[] public productDates;
  7. function setProduct(string _concept, uint256 _quantity, uint _date) public {
  8. var newproduct = allProducts[_date];
  9. newproduct.concept = _concept;
  10. newproduct.quantity = _quantity;
  11. productDates.push(_date) -1;
  12. }
  13. function getProducts() view public returns (uint[]) {
  14. return productDates;
  15. }
  16. function getProduct(uint date) view public returns (string, uint256) {
  17. return (allProducts[date].concept, allProducts[date].quantity);
  18. }
Add Comment
Please, Sign In to add comment