Exemplo n.º 1
0
 public static void show(Long id) {
   System.out.printf("=== id: %d\n", id);
   List<AuctionItem> items = AuctionItem.findAll();
   for (AuctionItem item : items) {
     System.out.printf("--- id: %d\n", item.id);
   }
   AuctionItem item = AuctionItem.findById(id);
   item.viewCount++;
   item.save();
   render(item);
 }
Exemplo n.º 2
0
  public static void doCreateItem(@Valid AuctionItem item) throws IOException {

    if (validation.hasErrors()) {
      System.out.println(validation.errorsMap());
      render("@createAuctionItem", item);
    }

    // set the user based on the logged in user
    item.createdBy = Authenticate.getLoggedInUser();

    item.save();
    show(item.id);
  }
Exemplo n.º 3
0
 public static void showPDF(Long id) {
   AuctionItem item = AuctionItem.findById(id);
   item.viewCount++;
   item.save();
   renderPDF(item);
 }
Exemplo n.º 4
0
 public static void addBid(Long id, Float amount) {
   AuctionItem item = AuctionItem.findById(id);
   item.addBid(amount);
   item.save();
 }