Skip to content
Snippets Groups Projects
Commit 10566dfa authored by michael.ramusi's avatar michael.ramusi
Browse files

order with args

parent d021512b
No related branches found
No related tags found
No related merge requests found
package ch.hepia.order; package ch.hepia.order;
import ch.hepia.account.*; import ch.hepia.account.*;
import ch.hepia.event.*; import ch.hepia.event.*;
import ch.hepia.stock.*; import ch.hepia.stock.*;
...@@ -27,11 +28,16 @@ public class http { ...@@ -27,11 +28,16 @@ public class http {
} }
@RequestMapping("/order") @RequestMapping("/order")
public Order order(@RequestParam(value="name", defaultValue="World") String name) { public Order order(
Order o = new Order(5, 1); @RequestParam(value = "idAccount", defaultValue = "1") int idAccount,
o.addProduct(1, 4); @RequestParam(value = "idProduct", defaultValue = "1") int idProduct,
o.addProduct(2, 10); @RequestParam(value = "quantity", defaultValue = "1") int quantity ) {
Event oc = new EventOrderCreated(o.id(), "hello", 1, o.getProducts());
int idOrder = 5;
Order o = new Order(idOrder, idAccount);
o.addProduct(idProduct, quantity);
Event oc = new EventOrderCreated(o.id(), "hello", idAccount, o.getProducts());
http.orderService.send(oc); http.orderService.send(oc);
return o; return o;
} }
...@@ -48,7 +54,6 @@ public class http { ...@@ -48,7 +54,6 @@ public class http {
return o; return o;
} }
@RequestMapping("/createAccount") @RequestMapping("/createAccount")
public String createAccount(@RequestParam(value = "name", defaultValue = "Orphée") String name) { public String createAccount(@RequestParam(value = "name", defaultValue = "Orphée") String name) {
accountService.send(new EventCreateAccount(1, "Creating the account", name)); accountService.send(new EventCreateAccount(1, "Creating the account", name));
...@@ -63,4 +68,5 @@ public class http { ...@@ -63,4 +68,5 @@ public class http {
return null; return null;
} }
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment