43 lines
1.3 KiB
Dart
43 lines
1.3 KiB
Dart
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
|
|
|
class CustomerExerciseDevice {
|
|
int customerExerciseDeviceId;
|
|
int exerciseDeviceId;
|
|
int customerId;
|
|
bool favourite;
|
|
DateTime dateAdd;
|
|
|
|
String change;
|
|
|
|
CustomerExerciseDevice({this.exerciseDeviceId, this.customerId, this.favourite}) {
|
|
dateAdd = DateTime.now();
|
|
}
|
|
|
|
CustomerExerciseDevice.fromJson(Map json) {
|
|
this.customerExerciseDeviceId = json['customerExerciseDeviceId'];
|
|
this.exerciseDeviceId = json['exerciseDeviceId'];
|
|
this.customerId = json['customerId'];
|
|
this.favourite = json['favourite'] == 1 ? true : false;
|
|
this.dateAdd = DateTime.parse(json['dateAdd']);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
if (customerExerciseDeviceId == null) {
|
|
return {
|
|
"exerciseDeviceId": exerciseDeviceId,
|
|
"customerId": customerId,
|
|
"favourite": favourite == true ? 1 : 0,
|
|
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
|
|
};
|
|
} else {
|
|
return {
|
|
"customerExerciseDeviceId": customerExerciseDeviceId,
|
|
"exerciseDeviceId": exerciseDeviceId,
|
|
"customerId": customerId,
|
|
"favourite": favourite == true ? 1 : 0,
|
|
"dateAdd": DateFormat('yyyy-MM-dd HH:mm:ss').format(this.dateAdd),
|
|
};
|
|
}
|
|
}
|
|
}
|