updateBusinessInfo function
Future<BusinessInfo>
updateBusinessInfo(
- int? businessInfoId,
- String contactNumber,
- String companyDescription,
- String businessStartTime,
- String businessFinishTime,
- String monday,
- String tuesday,
- String wednesday,
- String thursday,
- String friday,
- String saturday,
- String sunday,
- String isPublished,
- String personInChargeName,
- String phoneNumber,
- String vendorEmail,
- String isPublished2,
- String vendorAddress,
- String country,
- String state,
- String city,
- String postCode,
- String businessLatitude,
- String businessLongitude,
- String isPublished3,
- String bankName,
- String accountNumber,
- String isPublished4,
Implementation
Future<BusinessInfo> updateBusinessInfo(
int? businessInfoId,
String contactNumber,
String companyDescription,
//String businessLogo,
String businessStartTime,
String businessFinishTime,
String monday,
String tuesday,
String wednesday,
String thursday,
String friday,
String saturday,
String sunday,
String isPublished,
String personInChargeName,
String phoneNumber,
//String businessLogo,
String vendorEmail,
String isPublished2,
String vendorAddress,
String country,
String state,
String city,
String postCode,
String businessLatitude,
String businessLongitude,
String isPublished3,
String bankName,
String accountNumber,
String isPublished4,
) async {
HttpOverrides.global = new MyHttpOverrides();
final response = await http.put(
// Uri.parse(
// 'https://172.30.1.10:45455/api/BusinessInfoModels/$businessInfoId'),
Uri.parse(
'https://192.168.1.106:45455/api/BusinessInfoModels/$businessInfoId'),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(<String, String>{
'businessInfoId': businessInfoId.toString(),
'contactNumber': contactNumber,
'companyDescription': companyDescription,
'businessStartTime': businessStartTime,
'businessFinishTime': businessFinishTime,
'monday': monday,
'tuesday': tuesday,
'wednesday': wednesday,
'thursday': thursday,
'friday': friday,
'saturday': saturday,
'sunday': sunday,
'isPublished': isPublished,
'personInChargeName': personInChargeName,
'phoneNumber': phoneNumber,
'vendorEmail': vendorEmail,
'isPublished2': isPublished2,
'vendorAddress': vendorAddress,
'country': country,
'state': state,
'city': city,
'postCode': postCode,
'businessLatitude': businessLatitude,
'businessLongitude': businessLongitude,
'isPublished3': isPublished3,
'bankName': bankName,
'accountNumber': accountNumber,
'isPublished4': isPublished4,
}),
);
if (response.statusCode == 200) {
// If the server did return a 200 CREATED response,
// then parse the JSON.
return BusinessInfo.fromJson(jsonDecode(response.body));
} else {
// If the server did not return a 200 CREATED response,
// then throw an exception.
throw Exception('Failed to create service.');
}
}