Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.

Working with computer ebean only #80

Open
HannahJSwystun opened this issue Oct 15, 2018 · 0 comments
Open

Working with computer ebean only #80

HannahJSwystun opened this issue Oct 15, 2018 · 0 comments

Comments

@HannahJSwystun
Copy link

Hello,

Can you help me please to use only computer ebean instead of ( computer , company ) !


    public CompletionStage<Result> create() {
        Form<Computer> computerForm = formFactory.form(Computer.class);
		Computer computer = computerForm.get();
        
// I don't know how to change this only for compter or may be remove it ?!!!
        return companyRepository.options().thenApplyAsync((Map<String, String> companies) -> {         
	
            return ok(views.html.createForm.render(computerForm)); }, httpExecutionContext.current());
  }

    
    public CompletionStage<Result> save() {
        Form<Computer> computerForm = formFactory.form(Computer.class).bindFromRequest();
        if (computerForm.hasErrors()) {

// How to change this line for computer only
            return companyRepository.options().thenApplyAsync(companies -> {

                return badRequest(views.html.createForm.render(computerForm));
            }, httpExecutionContext.current());
        }

        Computer computer = computerForm.get();
        return computerRepository.insert(computer).thenApplyAsync(data -> {
            flash("success", "Computer " + computer.name + " has been created");
            return GO_HOME;
        }, httpExecutionContext.current());
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants