26 lines
824 B
Dart
26 lines
824 B
Dart
import 'package:intl/intl.dart';
|
|
|
|
class CustomerMembership {
|
|
late int membershipId;
|
|
int? customerId;
|
|
DateTime? startDate;
|
|
DateTime? endDate;
|
|
|
|
CustomerMembership.fromJson(Map json) {
|
|
membershipId = json['membershipId'];
|
|
customerId = json['customerId'] ?? 0;
|
|
startDate = json['startDate'] == null ? null : DateTime.parse(json['startDate']);
|
|
endDate = json['endDate'] == null ? null : DateTime.parse(json['endDate']);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
"membershipId": membershipId,
|
|
"customerId": customerId ?? 0,
|
|
"startDate": startDate == null ? "" : DateFormat('yyyy-MM-dd HH:mm:ss').format(startDate!),
|
|
"endDate": startDate == null ? "" : DateFormat('yyyy-MM-dd HH:mm:ss').format(endDate!),
|
|
};
|
|
|
|
@override
|
|
String toString() => toJson().toString();
|
|
}
|