add discount api

This commit is contained in:
Sai Naw Wun
2020-10-15 10:53:41 +06:30
parent 47c07a6c88
commit 37289e42c0
7 changed files with 122 additions and 64 deletions

View File

@@ -1,16 +1,38 @@
class Discount {
String id;
String code;
String customer;
String customerId;
String customerName;
String status;
double amount;
int weight;
double discountRate;
Discount(
{this.code,
this.customer,
this.amount,
this.status,
this.weight,
this.discountRate});
Discount({
this.id,
this.code,
this.customerId,
this.customerName,
this.amount,
this.status,
});
Map<String, dynamic> toMap() {
return {
'id': id,
'code': code,
"customer_id": customerId,
"customer_name": customerName,
"amount": amount,
};
}
factory Discount.fromMap(Map<String, dynamic> map, String id) {
return Discount(
id: id,
code: map['code'],
customerId: map['customer_id'],
customerName: map['customer_name'],
amount: map['amount'],
status: map['status'],
);
}
}