How to update database entity in java play framework

490 Views Asked by At

I am new on play framework java, i am doing on store management system and i need to know how to use class calculation if i sell s.thing to the client from store A to client X , when i check remaining quantity in the store A i can find that the quantity was updated( reduced) according to the quantity sold to the client.

model method used to sell a product to client X:

 public static void save(Customer_one customer) {


             customer.save();

}

controller method used to sell a product to client X :

public static Result sell( ) {

    Form<Customer_one> formData_one = Form.form(Customer_one.class).bindFromRequest();
 Customer_one.save(formData_one.get());
   return ok("product was been sold successfully");

}

The following method is used to check remaining product in the store A

   public static Result RemainingQuantity(){
         Form<Store> taskData = form(Store.class);
        return ok(views.html.store.render(Store.bal(),    taskData));
    }
0

There are 0 best solutions below