Package controllers

Source Code of controllers.Application

package controllers;

import play.*;
import play.mvc.*;

import views.html.*;

import models.Person;

import play.data.Form;

import java.util.List;

import play.db.ebean.Model;

import static play.libs.Json.*;

public class Application extends Controller {

    public Result index() {
        return ok(index.render());
    }

    public Result addPerson() {
      Person person = Form.form(Person.class).bindFromRequest().get();
      person.save();
      return redirect(routes.Application.index());
    }

    public Result getPersons() {
      List<Person> persons = new Model.Finder(String.class, Person.class).all();
      return ok(toJson(persons));
    }
}
TOP

Related Classes of controllers.Application

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.