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

Working with computer ebean only #80

Open

Description

@HannahJSwystun

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 join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions