updateBusinessInfo function

Future<BusinessInfo> updateBusinessInfo(
  1. int? businessInfoId,
  2. String contactNumber,
  3. String companyDescription,
  4. String businessStartTime,
  5. String businessFinishTime,
  6. String monday,
  7. String tuesday,
  8. String wednesday,
  9. String thursday,
  10. String friday,
  11. String saturday,
  12. String sunday,
  13. String isPublished,
  14. String personInChargeName,
  15. String phoneNumber,
  16. String vendorEmail,
  17. String isPublished2,
  18. String vendorAddress,
  19. String country,
  20. String state,
  21. String city,
  22. String postCode,
  23. String businessLatitude,
  24. String businessLongitude,
  25. String isPublished3,
  26. String bankName,
  27. String accountNumber,
  28. 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.');
  }
}