Package controllers

Source Code of controllers.MyBookApplication

package controllers;

import java.util.List;

import models.MyBook;
import yalp.mvc.Controller;

public class MyBookApplication extends Controller {

    public static void index() {
        List<MyBook> testEntries = MyBook.all().fetch();
        render(testEntries);
    }
   
    public static void edit(Long id) {
        MyBook testObj = MyBook.findById(id);
        notFoundIfNull(testObj);
        render(testObj);
    }

   
    public static void save(long id, MyBook testObj) {
        if (!testObj.isPersistent()) {
            notFound("The object Test with id "+ id + " wasn't found anymore!");
        }
        if (testObj.validateAndSave()) {
            index();
        } else {
            render("Application/edit.html", testObj);
        }
    }
   

}
TOP

Related Classes of controllers.MyBookApplication

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.