Exemplo n.º 1
0
 @HasPermissions("product.create")
 @Request.Post("/product/create")
 public Result create(Params params, Multiparts multiparts) {
   Map<String, Object> fieldMap = params.getFieldMap();
   Multipart multipart = multiparts.getOne();
   boolean success = productService.createProduct(fieldMap, multipart);
   return new Result(success);
 }
Exemplo n.º 2
0
 @HasRoles("admin")
 @Request.Post("/product/upload_picture/{id}")
 public Result uploadPicture(long id, Params params, Multiparts multiparts) {
   Map<String, Object> fieldMap = params.getFieldMap();
   Multipart multipart = multiparts.getOne();
   boolean success = productService.updateProduct(id, fieldMap, multipart);
   return new Result(success).data(multipart.getFileName());
 }