コード例 #1
0
 public static Result verify_get(Long id) {
   Customer customer = Customer.get(id);
   ImageUploadForm imgform = new ImageUploadForm();
   imgform.accountNo = customer.accountNumber;
   String accno = customer.accountNumber;
   return ok(verify.render(imageForm.fill(imgform), accno));
 }
コード例 #2
0
 public static Result delete(Long id) {
   Customer customer = Customer.get(id);
   if (customer == null) {
     return notFound(Messages.get("id.not.exists", id));
   }
   Customer.delete(id);
   return ok(Messages.get("record.deleted.succ"));
 }
コード例 #3
0
  /**
   * Return Customer by id.
   *
   * @return
   */
  public static Result get(Long id) {
    if (id == null) {
      return badRequest(Messages.get("id.expecting"));
    }

    Customer customer = Customer.get(id);

    if (customer == null) {
      return notFound(Messages.get("id.not.exists", id));
    }
    JsonNode result = Json.toJson(customer);
    return ok(result);
  }
コード例 #4
0
  public static Result update_get(Long id) {
    Customer customer = Customer.get(id);

    CustomerForm csForm = new CustomerForm();
    csForm.fname = customer.fname;
    // id=customer.id;
    csForm.lname = customer.lname;
    csForm.address = customer.address;
    csForm.mobile = customer.mobile;
    csForm.email = customer.email;

    return ok(update.render(customerForm.fill(csForm), id));
  }
コード例 #5
0
  public static Result update_save(Long id) {
    Form<CustomerForm> filledForm = customerForm.bindFromRequest();

    if (filledForm.hasErrors()) {
      return badRequest(update.render(filledForm, id));
    }

    CustomerForm customerForm = filledForm.get();
    if (customerForm == null) {
      return badRequest(update.render(filledForm, id));
    }

    Customer customer = Customer.get(id);

    if (customer == null) {
      filledForm.reject(Messages.get("id.not.exists", id));
      return badRequest(update.render(filledForm, id));
    }

    formToModel(customer, customerForm);
    customer.update();

    return redirect(controllers.routes.CustomerController.index());
  }