You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
diplomatic-quarter/lib/core/service/vaccine_service.dart

49 lines
1.5 KiB
Dart

import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/service/base_service.dart';
import 'package:diplomaticquarterapp/core/model/vaccine/my_vaccine.dart';
class VaccineService extends BaseService {
List<VaccineModel> _vaccineList = List();
List<VaccineModel> get vaccineList => _vaccineList;
Future getMyVaccine() async {
Map<String, dynamic> body = Map();
body['To'] = "0";
body['From'] = "0";
hasError = false;
_vaccineList.clear();
await baseAppClient.post(GET_VACCINES,
onSuccess: (dynamic response, int statusCode) {
response['List_DoneVaccines'].forEach((item) {
_vaccineList.add(VaccineModel.fromJson(item));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
Future sendEmail() async {
Map<String, dynamic> body = Map();
body['ListVaccines'] = vaccineList.map((v) => v.toJson()).toList();
body['ListVaccines'] = user.emailAddress;
body['DateofBirth'] = user.dateofBirth;
body['PatientIditificationNum'] = user.patientIdentificationNo;
body['PatientMobileNumber'] = user.mobileNumber;
body['PatientName'] = user.firstName + " "+ user.lastName;
hasError = false;
await baseAppClient.post(GET_VACCINES,
onSuccess: (dynamic response, int statusCode) {
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: body);
}
}